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
 
How to add field from header record to detail records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
tuxama

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Tue Jan 22, 2008 6:23 pm    Post subject: How to add field from header record to detail records
Reply with quote

Hello,

I have a problem and I don't know how to solve it with ICETOOL.

I have a fixed input file (lrecl=80) that contains groups of records each of which has a header
record, detail records. Here's an example of the input file:

Code:

LNSCACON 159100489  00000001         
LNSCAGAR 110S       00000001  00000001
LNSCAGAR 190S       00000001  00000002
LNSCACON 192064012  00000002         
LNSCAGAR 130TC      00000002  00000003
LNSCAGAR 199TC      00000002  00000004
LNSCACON 192068606  00000003         
LNSCAGAR 110S       00000003  00000005
LNSCAGAR 130S       00000003  00000006
LNSCAGAR 190S       00000003  00000007
LNSCAGAR 199S       00000003  00000008


The header record is identified by 'LNSCACON' all other records are detail records and are identified by 'LNSCAGAR'.
After a first ICETOOLS my input file is sorted by groups.

What I need, is to add an information from header record to detail records :

Code:

LNSCACON 159100489  00000001         
LNSCAGAR 110S       00000001  00000001  159100489
LNSCAGAR 190S       00000001  00000002  159100489
LNSCACON 192064012  00000002         
LNSCAGAR 130TC      00000002  00000003  192064012
LNSCAGAR 199TC      00000002  00000004  192064012
LNSCACON 192068606  00000003         
LNSCAGAR 110S       00000003  00000005  192068606
LNSCAGAR 130S       00000003  00000006  192068606
LNSCAGAR 190S       00000003  00000007  192068606
LNSCAGAR 199S       00000003  00000008  192068606


This is not a problem if the added information is also added to the header record.

Code:

LNSCACON 159100489  00000001            159100489
LNSCAGAR 110S       00000001  00000001  159100489
LNSCAGAR 190S       00000001  00000002  159100489
LNSCACON 192064012  00000002            192064012
LNSCAGAR 130TC      00000002  00000003  192064012
LNSCAGAR 199TC      00000002  00000004  192064012
LNSCACON 192068606  00000003            192068606
LNSCAGAR 110S       00000003  00000005  192068606
LNSCAGAR 130S       00000003  00000006  192068606
LNSCAGAR 190S       00000003  00000007  192068606
LNSCAGAR 199S       00000003  00000008  192068606


An idea ?


For informations

How I sorted by groups ?

Code:

//TOOLIN DD *
 COPY FROM(FUNLOAD) TO(TMPA) USING(CTL1)   
 COPY FROM(TMPA) TO(TMPB) USING(CTL2)       
                                           
 SELECT FROM(TMPB) TO(TMPC) ON(10,19,CH) - 
        NODUPS DISCARD(DUPS) USING(CTL3)   

//CTL1CNTL DD *
 INCLUDE COND=(11,8,CH,EQ,C'LNSCACON',OR,11,8,CH,EQ,C'LNSCAGAR')
 OUTFIL FNAMES=TMPA,OUTREC=(5,80),VTOF                         
 INREC  IFTHEN=(WHEN=(11,8,CH,EQ,C'LNSCACON'),                 
           BUILD=(1,4,11,8,1X,52,10)),                         
        IFTHEN=(WHEN=(11,8,CH,EQ,C'LNSCAGAR'),                 
           BUILD=(1,4,11,8,1X,52,5))                           

//CTL2CNTL DD *
 INREC  IFTHEN=(WHEN=INIT,                               
           OVERLAY=(21:SEQNUM,8,ZD)),                   
        IFTHEN=(WHEN=(1,8,CH,EQ,C'LNSCACON'),           
           BUILD=(1,20,21:SEQNUM,8,ZD)),                 
        IFTHEN=(WHEN=NONE,                               
           OVERLAY=(31:SEQNUM,8,ZD,                     
                    21:21,8,ZD,SUB,31,8,ZD,M11,LENGTH=8))

//CTL3CNTL DD *
 INCLUDE COND=(1,8,CH,EQ,C'LNSCAGAR')


FUNLOAD INPUT FILE
Code:

LNSCACON 159100489 
LNSCAGAR 110S       
LNSCAGAR 190S       
LNSCACON 192064012 
LNSCAGAR 130TC     
LNSCAGAR 199TC     
LNSCACON 192068606 
LNSCAGAR 110S       
LNSCAGAR 130S       
LNSCAGAR 190S       
LNSCAGAR 199S
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Jan 22, 2008 10:29 pm    Post subject: Reply to: How to add field from header record to detail reco
Reply with quote

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//IN       DD *                                       
LNSCACON 159100489  00000001                         
LNSCAGAR 110S       00000001  00000001               
LNSCAGAR 190S       00000001  00000002               
LNSCACON 192064012  00000002                         
LNSCAGAR 130TC      00000002  00000003               
LNSCAGAR 199TC      00000002  00000004               
LNSCACON 192068606  00000003                         
LNSCAGAR 110S       00000003  00000005               
LNSCAGAR 130S       00000003  00000006               
LNSCAGAR 190S       00000003  00000007               
LNSCAGAR 199S       00000003  00000008               
//OUT      DD SYSOUT=*                               
//TOOLIN    DD *                                     
  SPLICE FROM(IN) TO(OUT)   -                         
  ON(81,08,CH) WITH(01,80)  -                         
  KEEPBASE WITHALL USING(CTL1)                       
//CTL1CNTL     DD *                                   
  INREC IFTHEN=(WHEN=INIT,                           
       OVERLAY=(81:SEQNUM,8,ZD)),                     
        IFTHEN=(WHEN=(1,8,CH,EQ,C'LNSCACON'),         
       OVERLAY=(81:SEQNUM,8,ZD,10,10)),               
        IFTHEN=(WHEN=NONE,                           
       OVERLAY=(89:SEQNUM,8,ZD,                       
                81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,                                 
        IFOUTLEN=80,                                 
        IFTHEN=(WHEN=(1,8,CH,NE,C'LNSCACON'),         
       OVERLAY=(40:89,10))                           
/*                                                   
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Tue Jan 22, 2008 10:51 pm    Post subject: Reply to: How to add field from header record to detail reco
Reply with quote

Really thanksSkolusu.
It is exactly what I needed.
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am

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