View previous topic :: View next topic
|
Author |
Message |
Prasmal
New User
Joined: 02 May 2006 Posts: 5
|
|
|
|
Hi,
My input file looks like below. I need to add a trailer record to the file, where my trailer must have a value 9 followed by the count of accounts and the total number of records in the file including the trailer.
input file
----+----1----+----2----+----3----+----4----+----5----+--
G123 8 1090023321869 20090525 960
G123 3O1090123021865 20090525 960
G998 3 1091460043049 20090526 PURCHA960
G998 8 1091460043049 20090526 960
G998 3 1091460043161 20090526 PURCHA960
G444 8 1091460043161 20090526 960
G444 3 1091480055351 20090528 PURCHA960
G555 8 1091480055351 20090528 960
G555 3S1230905150921 20090409 INTERE800
I'm able to find the total no. of records including trailer , but am not able to find the count of the specific value that appears on the file
Trailer record
9 000000000004000000000010
9- Default value that must appear on the file
4 - count of type number
10 - count of total records including header
The value "8" in the position 8 helps to differentiate the type number
My output file must have all the data as in the input, with the trailer included.
Outfile
G123 1 1091450021869 20090525 960
G123 3D1091450021869 20090525 960
G998 3 1091460043049 20090526 PURCHA960
G998 1 1091460043049 20090526 960
G998 3 1091460043161 20090526 PURCHA960
G444 1 1091460043161 20090526 960
G444 3 1091480055351 20090528 PURCHA960
G555 1 1091480055351 20090528 960
G555 3P12309051509282220090409 INTERE800
9 000000000004000000000010 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your description is rather confusing.
Where is the account field that you want a count of - is it in positions 1-4 or somewhere else?
You say
Quote: |
My output file must have all the data as in the input, with the trailer included. |
But you show output records that are different than the input records. For example in the input the first record has '8' and the second record has '3O', but in the output the first record has '1' and the second record has '3D' - why the change?
Please show a better example of input and output and explain the "rules" for getting from input to output more clearly. Give the starting position, length and format of each relevant field (including those in the trailer record). Give the RECFM and LRECL of the input file. |
|
Back to top |
|
|
Prasmal
New User
Joined: 02 May 2006 Posts: 5
|
|
|
|
G123 8 1090023321869 20090525 960
The "8" in the 6th position tells me that this is a unique account. Under each account I have several other data. There are many such accounts in the file. I want to count all those accounts and write it in the trailer.
123
444
555
998 are the different accounts in the provided example. The value 8 will appear only on once for each account.
FB, 500 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for. I assumed '8' was in position 6 as you said in your last note (not position 8 as you said in a previous note). Since you didn't say, I assumed you wanted the trailer info to start in position 22. Change as needed.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/500)
//SORTOUT DD DSN=... output file (FB/500)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(501:C'0')),
IFTHEN=(WHEN=(6,1,CH,EQ,C'8'),OVERLAY=(501:C'1'))
OUTFIL REMOVECC,BUILD=(1,500),
TRAILER1=(22:C'9',24:TOT=(501,1,ZD,M11,LENGTH=12),
36:COUNT+1=(M11,LENGTH=12))
/*
|
|
|
Back to top |
|
|
Prasmal
New User
Joined: 02 May 2006 Posts: 5
|
|
|
|
Hi Frank,
Thank You very much. The sort card helped.
Your timely help is very much appreciated. |
|
Back to top |
|
|
|