Page 1 of 1

Count a specific Type in file & update trailer with count

PostPosted: Thu Jun 06, 2013 11:47 pm
by shri2win
Hello,
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 /*     


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


Please help, thanks.

Re: Count a specific Type in file & update trailer with coun

PostPosted: Fri Jun 07, 2013 12:19 am
by Akatsukami
  1. You should enclose your JCL, data, etc. -- aything where alignment is important -- in Code tags.
  2. Your control cards should not begin in column 1.

Re: Count a specific Type in file & update trailer with coun

PostPosted: Fri Jun 07, 2013 1:39 am
by dick scherrer
Hello,

Your post has been "Code'd". You need to use the Code tag in the future.

You need to look in the Syncsort documentation and/or some of the topics here in the forum to see why your syntax is invalid.

You need to post what you want as output from that sample input.

I seem to recall a very similar (exact same?) topic recently. Do NOT post the same question multiple times/places. It will not help you get better replies and several of us will silently delete duplicate posts.

Re: Count a specific Type in file & update trailer with coun

PostPosted: Fri Jun 07, 2013 9:42 pm
by NicC
I cannot lock anywhere else but I can here. Lockking.