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
 

 

File Manipulation using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: File Manipulation using DFSORT
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 Moderator


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

PostPosted: Mon Nov 24, 2008 10:47 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Nov 25, 2008 9:39 pm    Post subject:
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    Post subject:
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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