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

Copying Headerwhen Concatenate two files


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

New User


Joined: 30 Nov 2006
Posts: 78
Location: SINGAPORE

PostPosted: Tue Dec 26, 2006 6:40 am
Reply with quote

Hi,
I need to concatenate two files LRECL = 360 and RECFM = FB
HHHHHHHHHH<control date>
xxx0000000120...
yyy0000000370...
zzz0000000100...
TTTTTTTTTT00000005900000000003<other details>

Trailer
position 11 to 21 for total value in records (starting from 4 till 14) ie 590 in this case

position 22 to 42 for count of records ie. 3 in this case

So, I have two files like this, I need to concatenate, using the header and trailer of any one of the file and modifying the total and the count in the final file.
I have read all the similar posts in this forum and I tried to prepare a JCL for this

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//FILE1 DD DSN=NCST.SGSIT.INTF.SECFILE.DT070206,DISP=SHR
//       DD DSN=NCST.SGSIT.INTF.SECFILE.DT080206,DISP=SHR
//TOOLIN DD *
  COPY FROM(FILE1) TO(OUT)
/*
//OUT DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE,DISP=OLD
/*
//S1 EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE,DISP=OLD
//SORTOUT  DD  DSNAME=NCST.NIMESH.SGPROD.COUNTER.FILE.TIN,
//             SPACE=(CYL,(30,30)),DISP=(MOD,CATLG),
//             DCB=(RECFM=FB,LRECL=80)
//SYSIN    DD    *
  OPTION COPY
* CREATE DFSORT SYMBOL FOR COUNT AS:
* CT,'CCCCCCCC'
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(C'CT,''',COUNT=(M11,LENGTH=10),C'''',80:X)
/*
//S2 EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//SYMNAMES DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE.TIN,
//            DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE,DISP=OLD
//SORTOUT DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE.T1,DISP=OLD
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,10,CH,EQ,C'HHHHHHHHHH',|,
             (1,10,CH,EQ,C'TTTTTTTTTT'))
* USE CT TO OVERLAY ORIGINAL COUNT IN TRAILER RECORD.
  INREC IFTHEN=(WHEN=(1,10,CH,EQ,C'TTTTTTTTTT'),
    OVERLAY=(10:CT))
/*
//S3 EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//SYMNAMES DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE.TIN,
//            DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE.T1,DISP=OLD
//SORTOUT DD DSN=NCST.NIMESH.SGPROD.COUNTER.FILE.T2,DISP=OLD
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
      TRAILER1=('TTTTTTTTTT',11:CT)
/*


The problem is using this JCL I am able to get a count but I can not copy the header and trailer from the existing file I have to create my own trailer. What I need is to copy the header and trailer from any one file and then modify it with the new count and total. [The total part is not in the above JCL but can be done, I have not used temp datasets as I was debugging the values]

Can somebody help me prepare a JCL which would do the task.
Thanks
Nimesh
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: Tue Dec 26, 2006 9:03 pm
Reply with quote

Quote:
position 11 to 21 for total value in records (starting from 4 till 14) ie 590 in this case

position 22 to 42 for count of records ie. 3 in this case


In your example input, the total is in positions 11-20, the value for the total is in positions 4-13 and the count is in positions 22-30, so that's what I used.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON1 DD DSN=...  input file1 (FB/360)
//     DD DSN=...  input file2 (FB/360)
//HDR DD DSN=&&HD,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TRL DD DSN=&&TR,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//DAT DD DSN=&&DT,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON2 DD DSN=*.HDR,VOL=REF=*.HDR,DISP=(OLD,PASS)
//     DD DSN=*.DAT,VOL=REF=*.DAT,DISP=(OLD,PASS)
//     DD DSN=*.TRL,VOL=REF=*.TRL,DISP=(OLD,PASS)
//OUT DD DSN=...  output file (FB/360)
//TOOLIN DD *
COPY FROM(CON1) USING(CTL1)
COPY FROM(CON2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(1,10,SS,EQ,C'HHHHHHHHHH,TTTTTTTTTT'),
    OVERLAY=(361:+0,TO=ZD,LENGTH=10)),
   IFTHEN=(WHEN=NONE,OVERLAY=(361:4,10))
  OUTFIL FNAMES=HDR,ENDREC=1
  OUTFIL FNAMES=DAT,OMIT=(1,10,SS,EQ,C'HHHHHHHHHH,TTTTTTTTTT')
  OUTFIL FNAMES=TRL,REMOVECC,NODETAIL,
    TRAILER1=(1:1,10,11:TOT=(361,10,ZD,M11,LENGTH=10),
      21:COUNT-4=(M11,LENGTH=10),31:31,256,287:287,74)
/*
//CTL2CNTL DD *
  OUTREC BUILD=(1,360)
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top