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

Copy header and trailer with record count including them


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Mar 06, 2008 8:04 pm
Reply with quote

Hi,

Here is my requirement.
My input file is of FB format and LRECL is 231 and two output files of same record length.

When 26,3 position is equal to ABC it should be written to ABC output file.
When 26,3 position is equal to XYZ or KLM it should be written to XYZ output file.
The header record for the output files should have the same header as input. The first 3 characters should be ABC or XYZ according to the output file replacing XXX.
The same way for the trailer record and the total record count should include header and trailer.

Input file will contain records as follows:
Code:

XXX200804211-FEB-2008 21:11:45                                         
20080211SMS   35305300003ABC   BDP14475825456887   THE TEXT
20080211SMS   35300000002ABC   BDP1447770450222    THE TEXT
20080211SMS   35300000001XYZ   BDP1441216527432    THE TEXT
20080211SMS   35305300009XYZ   BDP144221144541     THE TEXT
20080211SMS   35305300002XYZ   BDP14477787878787   THE TEXT
20080211SMS   35305300001XYZ   BDP14477785825641   THE TEXT
20080211SMS   35305300000KLM   BDP1442246448641    THE TEXT
20080211SMS   35305300000KLM   BDP1447777748641    THE TEXT
20080211SMS   35300000004KLM   BDP1442227984190    THE TEXT
XXX20080420000001111-FEB-2008 21:11:45                                 


ABC output file is as follows:
Code:

ABC200804211-FEB-2008 21:11:45                                 
20080211SMS   35300000001ABC   BDP1441216527432    THE TEXT
20080211SMS   35305300009ABC   BDP144221144541     THE TEXT
20080211SMS   35305300002ABC   BDP14477787878787   THE TEXT
20080211SMS   35305300001ABC   BDP14477785825641   THE TEXT
RBS20080420000000611-FEB-2008 21:11:45                         


XYZ output file is as follows:
Code:

XYZ200804211-FEB-2008 21:11:45                                 
20080211SMS   35305300003XYZ   BDP14475825456887   THE TEXT
20080211SMS   35300000002XYZ   BDP1447770450222    THE TEXT
20080211SMS   35305300000KLM   BDP1442246448641    THE TEXT
20080211SMS   35305300000KLM   BDP1447777748641    THE TEXT
20080211SMS   35300000004KLM   BDP1442227984190    THE TEXT
XYZ20080420000000711-FEB-2008 21:11:45                         


How can i do this. I had done this job which is very length and in 3 steps. I had attached here. How can i modify this to simpler. Or any other alternative solution.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Mar 06, 2008 10:37 pm
Reply with quote

Hi,
Can anyone guide me for this job.
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: Fri Mar 07, 2008 12:15 am
Reply with quote

The output you show doesn't match your description of the rules.

I see two 26,3 = ABC records in the input file, but you show four in the output file - why?

I see four 26,3 = XYZ records in the input file, but you show two in the output file - why?

Why does the trailer record for the ABC output file have RBS instead of ABC?

Can the header and trailer records in the input file be identified by 'XXX' in positions 1-3 (the other records don't have that), or can they be identified some other way?

What is the starting position, length and format of the total record count value in the trailer record.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Fri Mar 07, 2008 3:30 pm
Reply with quote

Hi Frank,

Sorry i had given input wrongly. Thanks for pointing out.
Here is the corect input and output files.

Input file will contain records as follows:
Code:

XXX200804211-FEB-2008 21:11:45                                         
20080211SMS   35305300003ABC   BDP14475825456887   THE TEXT
20080211SMS   35300000002ABC   BDP1447770450222    THE TEXT
20080211SMS   35300000001ABC   BDP1441216527432    THE TEXT
20080211SMS   35305300009ABC   BDP144221144541     THE TEXT
20080211SMS   35305300002XYZ   BDP14477787878787   THE TEXT
20080211SMS   35305300001XYZ   BDP14477785825641   THE TEXT
20080211SMS   35305300000KLM   BDP1442246448641    THE TEXT
20080211SMS   35305300000KLM   BDP1447777748641    THE TEXT
20080211SMS   35300000004KLM   BDP1442227984190    THE TEXT
XXX20080420000001111-FEB-2008 21:11:45                                 


ABC output file is as follows:
Code:

ABC200804211-FEB-2008 21:11:45                                 
20080211SMS   35305300003ABC   BDP14475825456887   THE TEXT
20080211SMS   35300000002ABC   BDP1447770450222    THE TEXT
20080211SMS   35300000001ABC   BDP1441216527432    THE TEXT
20080211SMS   35305300009ABC   BDP144221144541     THE TEXT
ABC20080420000000611-FEB-2008 21:11:45                     


XYZ output file is as follows:
Code:

XYZ200804211-FEB-2008 21:11:45                                 
20080211SMS   35305300002XYZ   BDP14477787878787   THE TEXT
20080211SMS   35305300001XYZ   BDP14477785825641   THE TEXT
20080211SMS   35305300000KLM   BDP1442246448641    THE TEXT
20080211SMS   35305300000KLM   BDP1447777748641    THE TEXT
20080211SMS   35300000004KLM   BDP1442227984190    THE TEXT
XYZ20080420000000711-FEB-2008 21:11:45                         


Quote:

Can the header and trailer records in the input file be identified by 'XXX' in positions 1-3 (the other records don't have that), or can they be identified some other way?


Yes. Header and trailer records can be identified by 'XXX' in positions 1-3. Other data records wont have 'XXX'.

Quote:

What is the starting position, length and format of the total record count value in the trailer record.

The trailer record format is as follows.
Position 1-3 will be either ABC or XYZ depending on the file we are writing
position 4-10 should be the same value from the input file
position 11-18 will be the record count of LENGTH 8
position 19 onwards should be the same values from input file
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: Sat Mar 08, 2008 12:33 am
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/216)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,3,CH,EQ,C'XXX',AND,31,1,CH,NE,C' ')
  OUTFIL REMOVECC,
    BUILD=(C'STG1,''',4,7,C'''',80:X,/,
      C'STG2,''',19,22,C'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file (FB/216)
//ABC DD DSN=...  ouput file1 (FB/216)
//XYZ DD DSN=...  ouput file2 (FB/216)
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,3,CH,EQ,C'XXX',AND,31,1,CH,NE,C' ')
  OUTFIL FNAMES=ABC,REMOVECC,
    INCLUDE=(1,3,CH,EQ,C'XXX',OR,26,3,CH,EQ,C'ABC'),
    IFTHEN=(WHEN=(1,3,CH,EQ,C'XXX'),OVERLAY=(1:C'ABC')),
    TRAILER1=(C'ABC',STG1,COUNT+1=(M11,LENGTH=8),STG2)
  OUTFIL FNAMES=XYZ,REMOVECC,
    INCLUDE=(1,3,CH,EQ,C'XXX',OR,26,3,SS,EQ,C'XYZ,KLM'),
    IFTHEN=(WHEN=(1,3,CH,EQ,C'XXX'),OVERLAY=(1:C'XYZ')),
    TRAILER1=(C'XYZ',STG1,COUNT+1=(M11,LENGTH=8),STG2)
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Mon Mar 10, 2008 4:48 pm
Reply with quote

Hi Frank,

Thank you so much.
It worked well.
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 7
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
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top