I am working on a requirement to count the occurence of a specific record in a file and update the trailer with the count vale.
All the records are RECFM=FB and LRECL=133, input file format is as-
ISA*00* *00*
GS*PC*XX*123456*130603*
ST*830*000226250*
N1*ST*C*
SE*
ST*830*000226250*
N1*ST*C*
SE*
ST*830*000226250*
N1*ST*C*
SE*
ST*830*000226250*
N1*PN I*
SE*000032*0
GE*ZZZZZZ*0
IEA*00001*0
I have to count all the "ST" (at the start of record, position 1) records and update the count value in record "GE".
For example- in the file mentioned above, there are 4 "ST" records here. So "GE*ZZZZZZ*0" should be => GE*4*0
Here is what I have done.
000090 //STEP7 EXEC PGM=SORT
000091 //SYSOUT DD SYSOUT=*
000092 //SORTIN DD DSN=SECZ1L8.A.S830SRT4,DISP=SHR
000093 //SORTOUT DD DSN=SECZ1L8.A.S830SRT5,DISP=(NEW,
000094 // CATLG,DELETE),UNIT=SYSDA,RECFM=FB,
000095 // LRECL=133,SPACE=(CYL,(50,50),RLSE)
000096 //SYSIN DD *
000097 OPTION COPY
000098 INREC IFOUTLEN=133,IFTHEN=(WHEN=(1,2,SS,EQ,C'ST,GE'),
000099 OVERLAY= (134:SEQNUM,6,FS,START=0,
000100 004:134,6,JFY=(SHIFT=LEFT,TRAIL=C'*0',LENGTH=130)))
000101 //*
000102 /*
000091 //SYSOUT DD SYSOUT=*
000092 //SORTIN DD DSN=SECZ1L8.A.S830SRT4,DISP=SHR
000093 //SORTOUT DD DSN=SECZ1L8.A.S830SRT5,DISP=(NEW,
000094 // CATLG,DELETE),UNIT=SYSDA,RECFM=FB,
000095 // LRECL=133,SPACE=(CYL,(50,50),RLSE)
000096 //SYSIN DD *
000097 OPTION COPY
000098 INREC IFOUTLEN=133,IFTHEN=(WHEN=(1,2,SS,EQ,C'ST,GE'),
000099 OVERLAY= (134:SEQNUM,6,FS,START=0,
000100 004:134,6,JFY=(SHIFT=LEFT,TRAIL=C'*0',LENGTH=130)))
000101 //*
000102 /*
After running the JCL, i get RC=0016. Here is the log info -
IEF403I SS$Z1L8T - STARTED - TIME=10.06.58
IEC130I SORTMSG DD STATEMENT MISSING
+WER268A SS$Z1L8T,STEP7 , -INREC STATEMENT : SYNTAX ERROR
+WER275A SS$Z1L8T,STEP7 , -NO KEYWORDS FOUND ON CONTROL STATEMENT
+WER211B SS$Z1L8T,STEP7 , -SYNCSMF CALLED BY SYNCSORT; RC=0000
+WER449I SS$Z1L8T,STEP7 , -SYNCSORT GLOBAL DSM SUBSYSTEM
ACTIVE
IEF655I INVALID DSNAME SPECIFIED WHEN SYSIN OR SYSOUT SPECIFIED
IEC130I SORTMSG DD STATEMENT MISSING
+WER268A SS$Z1L8T,STEP7 , -INREC STATEMENT : SYNTAX ERROR
+WER275A SS$Z1L8T,STEP7 , -NO KEYWORDS FOUND ON CONTROL STATEMENT
+WER211B SS$Z1L8T,STEP7 , -SYNCSMF CALLED BY SYNCSORT; RC=0000
+WER449I SS$Z1L8T,STEP7 , -SYNCSORT GLOBAL DSM SUBSYSTEM
ACTIVE
IEF655I INVALID DSNAME SPECIFIED WHEN SYSIN OR SYSOUT SPECIFIED
Please help, thanks.