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
 

 

Add a field from one file to a second file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Add a field from one file to a second file
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 Moderator


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

PostPosted: Fri Nov 24, 2006 9:34 pm    Post subject:
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    Post subject: Re: Add a field from one file to a second file
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 Moderator


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

PostPosted: Sat Nov 25, 2006 9:07 pm    Post subject:
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    Post subject: Re: Add a field from one file to a second file
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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