Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Count of specific values in the detail record on trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Count of specific values in the detail record on trailer
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 Moderator


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

PostPosted: Thu Sep 03, 2009 10:11 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Sep 03, 2009 11:28 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us