View previous topic :: View next topic
Author
Message
balukanna New User Joined: 09 Apr 2008Posts: 41 Location: USA
Hi..
I need to insert a value in the file header, the inserting value should be taken from the file itself.
ForEx:
Input file:
Code:
*******************************
REPORT
SRNO NAME
*******************************
01 AAAA
02 BBBB
03 CCCC
04 DDDD
Output file:
Code:
*******************************
REPORT
Count 04
SRNO NAME
*******************************
01 AAAA
02 BBBB
03 CCCC
04 DDDD
_________
Thanks
Balukanna
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You need to explain more clearly what you're trying to do.
Is the 04 in the Count 04 line the count of data records, or the first field from the last record, or what?
If it's the count of data records, how do we determine where the data records start in the input file? Is it with the 7th record? Or is there some other rule we need to use?
Back to top
balukanna New User Joined: 09 Apr 2008Posts: 41 Location: USA
Sorry,
The "04" is first field of the last record (position 01 - 02),
it is not the count of records, need to move the value present in the first two position of last record.
Back to top
balukanna New User Joined: 09 Apr 2008Posts: 41 Location: USA
Very Sorry, missed something in the above reply,
Need the Value of last SRNO field.
In the below Example, in output file the value "04" of SRNO field is to be populated in the header line (i.e count 04)
Input file:
Code:
*******************************
REPORT
SRNO NAME
*******************************
01 AAAA
02 BBBB
BBBBA
BBBBC
03 CCCC
CCCCA
04 DDDD
DDDDA
DDDDB
Output file:
Code:
*******************************
REPORT
Count 04
SRNO NAME
*******************************
01 AAAA
02 BBBB
BBBBA
BBBBC
03 CCCC
CCCCA
04 DDDD
DDDDA
DDDDB
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
balukanna,
The following DFSORT JCL will give you the desired results
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
INCLUDE COND=(1,2,ZD,EQ,NUM)
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('SRNO,C''',1,2,C'''',80:X)
/*
//STEP0200 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&T1,DISP=SHR
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(81,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))
/*
Back to top
balukanna New User Joined: 09 Apr 2008Posts: 41 Location: USA
Hi Skolusu,
I tried the above with a file length of 80, it works fine,
When i tried for a file length 410 it is giving S013 Abend,
i tried to clear the S013 Abend
(The SORTIN, SORTOUT, or OUTFIL BLKSIZE parameter),
but i Can't, please help to clear it.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
balukanna,
Change your step0200 control cards to the following
Code:
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=410,IFTHEN=(WHEN=INIT,OVERLAY=(411:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(411,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))
/*
Back to top
balukanna New User Joined: 09 Apr 2008Posts: 41 Location: USA
Hi Skolusu,
i Have tried the below sort for Record length 410, its giving the same abend (S013), please advise if i given anything wrong in the below one.
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Input File1
//SORTOUT DD DSN=Temp File/File2
//SYSIN DD *
INCLUDE COND=(1,2,ZD,EQ,NUM)
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('SRNO,C''',1,2,C'''',410:X)
/*
//STEP0200 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=Temp File/File2,DISP=SHR
//SORTIN DD DSN=Input File1,DISP=SHR
//SORTOUT DD DSN=Outpt File,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=410,IFTHEN=(WHEN=INIT,OVERLAY=(411:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(411,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))
/*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Kolusu had:
Code:
TRAILER1=('SRNO,C''',1,2,C'''',80:X)
You changed it to:
Code:
TRAILER1=('SRNO,C''',1,2,C'''',410:X)
Kolusu showed you the change needed in STEP0200 . He did NOT tell you to change anything in STEP0100, so why did you change that. You need to change it back to 80:X.
Back to top
Please enable JavaScript!