START
positions an indexed file so that a following sequential read will read from
the Start record. For example: -
START VSFILE1(GROUP1.VSFILE1-KEY-AREA >= EZT-EZTPOINT-Data.VSFL-KEY);
START may be the result of converting an EZT statement like
POINT VSFILE1 GE VSFL-KEY STATUS
or the statement may be
written directly.
START itself does not
read a record. It will be followed by a
loop that reads further records from the file (VSFILE1), for example
START VSFILE1(VSFILE1.GROUP1.VSFILE1-KEY-AREA >= EZT-EZTPOINT-Data.VSFL-KEY
);
PROCESS
VSFILE1 UNTIL VSFILE1.$ENDFILE = True SID(22);
#393 W $EndFile is not a key field
IF VSFILE1.VSFILE1-KEY-AREA-COMPANY = COMPANY.COMPANY-CODE;
OUTFILE.OUTFILE-RECORD
= 'WRITING OUTPUT
RECORD';
WRITE
OUTFILE;
#378 W
Batch WRITE used - you may need to edit the JCL
END IF;
END PROCESS VSFILE1;
See START and Error Handling. below for another example, with output.
See https://www.jazzsoftware.co.nz/Docs/JazzUGEZTLogic2.htm#POINT for information on
converting EZT POINT and following
statements.
START File-Name(Key-Name Operator Value);
POINT will be recognized as a synonym and changed to START.
Punctuation (Brackets and Semicolon) will be automatically
inserted if they are omitted.
This must
name a keyed file, i.e. a VSAM or similar file – not sequential, not SQL, and
not a non-file record type (WORK
etc). The file definition must identify
one of its fields, or a field group, as its record key. For example: -
DEFINE RDFile TYPE(VSAM) DATA(
KEYFIELDS GROUP
KEY,
REGION FIXED(3),
DISTRICT FIXED(3),
ENDGROUP,
NAME CHAR(30));
Or
DEFINE VSFILE1 VSAM DATA(
GROUP1 GROUP,
VSFILE1-KEY-AREA CHAR(26) CAPS KEY,
VSFILE1-DATA-AREA CHAR(18),
End GROUP,
If you name the
key as $KEY, the name of the group or field defined with the KEY
property will replace $KEY. For example
START RDFILE $KEY … =>
START RDFILE(KEYFIELDS
…
START VSFILE1 $KEY … =>
START VSFILE1(GROUP1.VSFILE1-KEY-AREA …
The key-name
must be a field or group defined with a KEY property (KEY,
UKEY,
or DKEY)
This
defines the relationship between Key-Name and Value. It may be one of =, >, >=, <, <=, or their
character equivalents EQ, GT, GE, LT, LE (which will be changed to the symbolic
form).
This is a
field that is compatible with Key-Name.
Like all
I/O statements, logic generated for a START
statement is always immediately followed with a check that the status code is
zero. If it is not, then a message is
displayed, and the program will be terminated with Return-code=16. This error handling cannot be turned off,
nor replaced with alternative logic.
Here’s an
example demonstrating error handling.
File FR is a VSAM file containing these records. Note that Region=7 is missing.
1Printed at 19 Apr 2025,
16:01:36 RepNbr1 Page 1
0Region *--------Region
Name---------*
0 001 New Zealand
002 Australia
003 United Kingdom
004 United States of America
005 Canada
006 France
008 Italy
009 South America
010 Africa
* * * END OF RepNbr1 * * *
This program was written to demonstrate how START works, including error handling. What do you expect it to do?
*# Last Updated by JAZZUSR at 19/04/2025
4:40:45 PM
PROGRAM POINT3 BATCH;
COPY FR;
FOR JZ2.IX = 3 TO 8 STEP 2;
DISPLAY(JZ2.IX) UPON SYSOUT;
START FR(FR.Region = JZ2.IX);
#827 I Help for START and related statements - https://tinyurl.com/3d7e4uz3
PROCESS FR SID(17);
PRINT (FR.Region,FR.Name) ;
END PROCESS FR;
END FOR;
It will print
Region’s 3 to 10, then Region’s 5 to 10, so we’ll see
this on the printer REPNBR1. I’ve highlighted the first and last records of each iteration:
-
1Printed at 19 Apr 2025,
16:41:34 RepNbr1 Page 1
0Region *--------Region
Name---------*
0 003 United Kingdom
004 United States of America
005 Canada
006 France
008 Italy
009 South America
010 Africa
005 Canada
006 France
008 Italy
009 South America
010 Africa
* * * END OF RepNbr1 * * *
File SYSOUT
shows output from the DISPLAY statement, plus the error message produced
when the START fails: -
SYSOUT
3
5
7
PROGRAM TERMINATED.
STATUS CODE FOR START =23
***END OF FILE***
JESYSMSG shows that Step 1 ends with condition code 16
11:28:07 JCLCM0191I STEP ENDED GO - COND CODE 0016
If START had been written with condition (FR.Region >= JZ2.IX) then the third iteration would have printed data from FR.Region = 8, and the step would have ended with COND CODE 0000