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

Add a field from one file to a second file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Fri Nov 24, 2006 5:17 pm
Reply with quote

Hi,

I have 2 files of different record lengths. The second file has just one record. I want to append the contents of the second file to all records of the first file.

Can this be done directly using SYNCSORT?

Thanks in Advance,
Aneesh.
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 Nov 24, 2006 9:34 pm
Reply with quote

You can do this with DFSORT, but you need to give more information about what you're trying to do. Please show an example of the records in file1 and the record in file2 and what you expect for the output records. Please give the RECFM and LRECL of each input file.
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Nov 25, 2006 11:56 am
Reply with quote

The first file is of 80 bytes(FB) - it has a list of transaction data. The second file is a parm file of 13 bytes (FB) and has the last run date and day(2006-11-24Fri).

The requirement is to append the second file data to the end of every record in the first file.
File1:
Trans1XXXX.....XXX
Trans2XXXX.....XXX
...
File2:(One record only)
2006-11-24Fri

Required output:(the length of the file will be 80 + 13 = 93)
Trans1XXXX.....XXX2006-11-24Fri
Trans2XXXX.....XXX2006-11-24Fri
...

Hope this makes it clear.
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 Nov 25, 2006 9:07 pm
Reply with quote

Aneesh,

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file2 (FB/13) - date record
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Create DFSORT symbol as follows:
* Mydate,'yyyy-mm-ddday'
  OUTREC BUILD=(C'Mydate,''',1,13,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=..  input file1 (FB/80) - transactions
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
* Use Mydate to add date at end of records.
  INREC OVERLAY=(81:Mydate)
/*
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Mon Nov 27, 2006 8:55 am
Reply with quote

Thanks a lot, Frank.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top