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

Converting multiple Headers and Trailers into one


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

New User


Joined: 10 Jul 2008
Posts: 4
Location: Hyderabad

PostPosted: Thu Jul 10, 2008 4:23 pm
Reply with quote

Hello,

I have data merged from two files like this

H0012008-07-012008-07-31
DDATA RECORD ONE
DDATA RECORD TWO
DDATE RECORD THREE
TTRAILER RECORD FOR FIRST FILE COUNT OF DATA RECORDS 00003
H0022008-07-01200807-31
DDATA RECORD FOUR
DDATA RECORD FIVE
DDATA RECORD SIX
DDATA RECORD SEVEN
TTRAILER RECORD FOR SECOND FILE COUNT OF DATA RECORDS 00004


In my output file I need one header (does not matter which one it is)
I need all the data records
I need one trailer(does not matter which one) with the count of total data records.
Effectively I need my output file some thing like this

H0012008-07-012008-07-31
DDATA RECORD ONE
DDATA RECORD TWO
DDATE RECORD THREE
DDATA RECORD FOUR
DDATA RECORD FIVE
DDATA RECORD SIX
DDATA RECORD SEVEN
TTRAILER RECORD FOR SECOND FILE COUNT OF DATA RECORDS 00007

First byte of the file would have 'H'eader, 'D'ata or 'T'railer
It is going to be a FB file of length 80. Count of records would come in trailer record from 73 through 80.

COuld this be accomplished through DFSORT? If so, kindly help.

Thanks,
Chandra


icon_question.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 10, 2008 9:19 pm
Reply with quote

chandra_devatha,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                   
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
H0012008-07-012008-07-31                                     
DDATA RECORD ONE                                             
DDATA RECORD TWO                                             
DDATE RECORD THREE                                           
TTRAILER RECORD FOR FIRST FILE COUNT OF DATA RECORDS 00003   
H0022008-07-01200807-31                                     
DDATA RECORD FOUR                                           
DDATA RECORD FIVE                                           
DDATA RECORD SIX                                             
DDATA RECORD SEVEN                                           
TTRAILER RECORD FOR SECOND FILE COUNT OF DATA RECORDS 00004 
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),         
  IFTHEN=(WHEN=(1,1,SS,EQ,C'H,T'),                           
  OVERLAY=(89:SEQNUM,1,ZD),HIT=NEXT),                       
  IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),                             
  OVERLAY=(73:81,8,ZD,SUB,+2,M11,LENGTH=8))                 
                                                             
  OUTFIL BUILD=(1,80),OMIT=(89,1,SS,EQ,C'2,3')               
//*                                                         
Back to top
View user's profile Send private message
chandra_devatha

New User


Joined: 10 Jul 2008
Posts: 4
Location: Hyderabad

PostPosted: Fri Jul 11, 2008 11:19 am
Reply with quote

Kolusu, Thanks a ton for your response.

I have tried executing the above. I am getting a SYSTEM=001 USER=0000 REASON=00000000 abend.

I have changed the above SORT Statements as below:

Code:

  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(72:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,1,SS,EQ,C'H,T'),
       OVERLAY=(80:SEQNUM,1,ZD),HIT=NEXT),
    IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),
      OVERLAY=(73:72,8,ZD,SUB,+2,M11,LENGTH=8))

    OUTFIL BUILD=(1,80),OMIT=(80,1,SS,EQ,C'2,3')


even after changing as above I am still getting a S001 abend.

Could you please help.

Thanks,
Chandra

I
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 11, 2008 8:16 pm
Reply with quote

Hello,

Please post the jcl and diagnostic info from the abended run.

It is likely that you have a dataset problem.
Back to top
View user's profile Send private message
chandra_devatha

New User


Joined: 10 Jul 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Jul 14, 2008 11:30 am
Reply with quote

Hello Dick,

Here is what I have in my JOB

//STEP01 EXEC PGM=ICEMAN
//*-------------------------
//SYSOUT DD SYSOUT=*
//SORTIN DD *
H0012008-07-012008-07-31
DDATA RECORD ONE
DDATA RECORD TWO
DDATE RECORD THREE
TTRAILER RECORD FOR 1ST FILE. RECORD COUNT 00003
H0022008-07-01200807-31
DDATA RECORD FOUR
DDATA RECORD FIVE
DDATA RECORD SIX
DDATA RECORD SEVEN
TTRAILER RECORD FOR 2ND FILE. RECROD COUNT 00004
//SORTOUT DD *
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(72:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,1,SS,EQ,C'H,T'),
OVERLAY=(80:SEQNUM,1,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),
OVERLAY=(73:72,8,ZD,SUB,+2,M11,LENGTH=8))

OUTFIL BUILD=(1,80),OMIT=(80,1,SS,EQ,C'2,3')
//*

Thanks,
Chandra
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 14, 2008 12:08 pm
Reply with quote

Hello,

That is part of what you needed to post. . .

You also need to post the diagnostic info presented by the run. There should be at least 2 "pieces" of diagnostic info. When you post these, the message numbers need to be included as well.
Back to top
View user's profile Send private message
chandra_devatha

New User


Joined: 10 Jul 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Jul 14, 2008 5:37 pm
Reply with quote

Hello Dick,

I was able to get this working. I guess the problem came when I tried with Instream data. I replaced SYSIN DD card with a dataset and it works well.

Kolusu, Thanks a lot. It works like a charm!

Regards,
Chandra
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 14, 2008 9:04 pm
Reply with quote

Hello,

Good to hear it is working icon_smile.gif

Quote:
I replaced SYSIN DD card with a dataset and it works well.
DCB mismatch problems with the instream data. . . . I'm sure the output dd * did not help icon_wink.gif
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
Search our Forums:

Back to Top