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

File Manipulation using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Mon Nov 24, 2008 3:58 pm
Reply with quote

Hi All,

I have two files as below.

File 1 Content

AAA BBB CCC
AAA EEE FFF
AAA GGG HHH
GGG HHH III

File 2 Content

XXX
YYY
ZZZ
WWW


I want my output file should be as below

AAA BBB CCC XXX
AAA BBB CCC YYY
AAA BBB CCC ZZZ
AAA BBB CCC WWW
AAA EEE FFF XXX
AAA EEE FFF YYY
AAA EEE FFF ZZZ


Is the above operation possible with DFSORT.


Thanks,
Abhishek
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: Mon Nov 24, 2008 10:47 pm
Reply with quote

It's not clear what you want to do. You need to explain the "rules" more clearly.

Do you want to append the fields from the file2 records to the fields from the file1 records one-by-one, for example, append XXX to the first file1 record fields, append YYY to the second file1 record fields, append ZZZ to the third file1 record fields, append WWW to the fourth file1 record fields, append XXX to the fifth file1 record fields, and so on?

Or do you want to append fields depending on a key? If so, which field is the key and what do you want to do exactly?

Or do you want to do something else?

Does file2 always have 4 records or can it have more or less records?

What is the RECFM and LRECL of each input file?
Back to top
View user's profile Send private message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Tue Nov 25, 2008 9:09 am
Reply with quote

Hi Frank,

I want File2 content to be appended to File1. For eg:
XXX appended to first record in File1 i.e AAA BBB CCC
YYY appended again to AAA BBB CCC
ZZZ appended again to AAA BBB CCC & so on.

I can say the File2 will have only 4 records
Record format of each file is fixed and Logical Rec length is 80.



Thanks,
Abhishek
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 Nov 25, 2008 9:39 pm
Reply with quote

You can use a DFSORT job like the one below to do what I think you asked for.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *   input file2 (FB/80)
XXX
YYY
ZZZ
WWW
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'CON',SEQNUM,1,ZD,C',''',1,3,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *   input file1 (FB/80)
AAA BBB CCC
AAA EEE FFF
AAA GGG HHH
GGG HHH III
/*
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL BUILD=(1,12,CON1,80:X,/,1,12,CON2,/,1,12,CON3,/,
    1,12,CON4)
/*


The SORTOUT from step S2 would have these records:

Code:

AAA BBB CCC XXX   
AAA BBB CCC YYY   
AAA BBB CCC ZZZ   
AAA BBB CCC WWW   
AAA EEE FFF XXX   
AAA EEE FFF YYY   
AAA EEE FFF ZZZ   
AAA EEE FFF WWW   
AAA GGG HHH XXX   
AAA GGG HHH YYY   
AAA GGG HHH ZZZ   
AAA GGG HHH WWW   
GGG HHH III XXX   
GGG HHH III YYY   
GGG HHH III ZZZ   
GGG HHH III WWW   
Back to top
View user's profile Send private message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Wed Nov 26, 2008 10:07 am
Reply with quote

Thanks Frank for the solution..its working good..



Thanks,
Abhishek
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
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
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top