IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Count of specific values in the detail record on trailer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Prasmal

New User


Joined: 02 May 2006
Posts: 5

PostPosted: Thu Sep 03, 2009 7:15 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 03, 2009 10:11 pm
Reply with quote

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
View user's profile Send private message
Prasmal

New User


Joined: 02 May 2006
Posts: 5

PostPosted: Thu Sep 03, 2009 10:45 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 03, 2009 11:28 pm
Reply with quote

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
View user's profile Send private message
Prasmal

New User


Joined: 02 May 2006
Posts: 5

PostPosted: Fri Sep 04, 2009 5:14 pm
Reply with quote

Hi Frank,

Thank You very much. The sort card helped.
Your timely help is very much appreciated.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top