Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copying Headerwhen Concatenate two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copying Headerwhen Concatenate two files
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 Moderator


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

PostPosted: Tue Dec 26, 2006 9:03 pm    Post subject:
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    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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us