|
View previous topic :: View next topic
|
| Author |
Message |
Nita Antony
New User
Joined: 30 Mar 2010 Posts: 2 Location: INDIA
|
|
|
|
Hi,
I have to update the Trailer of a file with a count from another file.
To be more specific, my requirement is like this.
In FILE1, the Trailer is as shown below.
9999999999000500000600
The green colored count is the no of occurences of 88888888as a record in FILE1. The violet colored count is the count of total number of records in the FILE1.
Can we have both these counts in the Trailer in a single step?
I tried, but since I am not able to I calculated the occurence of 888888888 in another STEP and I have the count in a file.
The FILE1 has the TRAILER 9999999999000000000600.
I want to update the TRAILER with the count in the other File.
Please advise.
Thanks,
Nita Antony. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Nita Antony,
You don't need 2 passes of data. Since you haven't told anything about the DCB properties of the input file, I assumed that it is 80 byte FB recfm file.
use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAA
88888888
BBBBBBBB
CCCCCCCC
88888888
DDDDDDDD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'88888888'),OVERLAY=(81:C'1'))
OUTFIL REMOVECC,BUILD=(1,80),
TRAILER1=('9999999999',TOT=(81,1,ZD,M11,LENGTH=5),
COUNT=(M11,LENGTH=7))
//* |
The output of this is (the count of 8888888 is 2 and total count is 6)
| Code: |
AAAAAAAA
88888888
BBBBBBBB
CCCCCCCC
88888888
DDDDDDDD
9999999999000020000006
|
|
|
| Back to top |
|
 |
Nita Antony
New User
Joined: 30 Mar 2010 Posts: 2 Location: INDIA
|
|
|
|
Hi,
The File is VB, with size 2602.
Thx, Nita. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Nita Antony,
*Sigh* what is the position of the string '88888888' . Assuming that your string is at position 5 ( 4 bytes RDW for VB files) the following DFSORT JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input VB 2602 file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'0',5)),
IFTHEN=(WHEN=(6,8,CH,EQ,C'88888888'),OVERLAY=(5:C'1'))
OUTFIL REMOVECC,BUILD=(1,4,6),
TRAILER1=('9999999999',TOT=(5,1,ZD,M11,LENGTH=5),
COUNT=(M11,LENGTH=7))
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|