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
 

 

Need parts of 2 files written to 1 file no matching fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Ed Groneman

New User


Joined: 11 Oct 2007
Posts: 7
Location: Cincinnati, OH

PostPosted: Mon Apr 20, 2009 8:19 pm    Post subject: Need parts of 2 files written to 1 file no matching fields
Reply with quote

Need to extract parts of 2 different files to create 1 file. All files 800 bytes,
All fields are alphanumeric. InFile1 has only 1 record. InFile2 position 5-20 is unique on each record. So OutFile3 should have same number output records as InFile2. Not sure of how to code a sort/merge to do this.

InFile1
Code:
1234567890123456789012345678901234567890123456789012345678
3210 5569260001718674 6423 Channel St   Orange River, DE

InFile2
Code:
1234567890123456789012345678901234567890123456789012345678901
John Smith    5569260001718672 124 Able Drive    Cleveland, OH
Edward Jackson5569260001718699  85 Miller St.    Cincinnati, OH
Mary Wilson   5569260001718702  8 Fifth St.   Boise, ID
Eldon Rogers  5569260001718717  19 Garnett Trail.   Kansas City, MO


Needed in File3:
Pos 1-4 Pos 1-4 from File1
Pos 5-20 Pos 16-31 from File2
Pos 21-33 Pos 23-54 from File1

OutFile3
Code:
123456789012345678901234567890123456789012345678901
321055692600017186726423 Channel St   Orange River, DE
321055692600017186996423 Channel St   Orange River, DE 
321055692600017187026423 Channel St   Orange River, DE
321055692600017187176423 Channel St   Orange River, DE


Any help is appreciated!
Ed G.
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 Apr 20, 2009 9:46 pm    Post subject:
Reply with quote

Quote:

Pos 5-20 Pos 16-31 from File2
Pos 21-33 Pos 23-54 from File1


This doesn't match your example (5-20 and 16-31 don't even have the same number of bytes).

Please correct this to what you really need.

Also, say what you want for the RECFM and LRECL of the output file and give the RECFM for the input files.
Back to top
View user's profile Send private message
Ed Groneman

New User


Joined: 11 Oct 2007
Posts: 7
Location: Cincinnati, OH

PostPosted: Mon Apr 20, 2009 10:51 pm    Post subject:
Reply with quote

Frank - sorry - does this make any more sense?

InFile1
3210 5569260001718674 6423 Channel St Orange River, DE
InFile2
John Smith 5569260001718672 124 Able Drive Cleveland, OH
Edward Jackson 5569260001718699 85 Miller St. Cincinnati, OH
Mary Wilson 5569260001718702 8 Fifth St. Boise, ID
Eldon Rogers 5569260001718717 19 Garnett Trail. Kansas City, MO
OutFile3
321055692600017186726423 Channel St Orange River, DE
321055692600017186996423 Channel St Orange River, DE
321055692600017187026423 Channel St Orange River, DE
321055692600017187176423 Channel St Orange River, DE

Pos 1-4 in Outfile3 should equal Pos 1-4 in File1
Pos 5-20(16 bytes) in OutFile3 should equal Pos 18 for 16 bytes from File2
Pos 21-55 (34 bytes) in OutFile3 should equal Pos 23-57 (34 bytes) from File1

The recfm for InFile1 & InFile2 is FB
The recfm for OutFile3 is FB, Lrecl=800
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Apr 20, 2009 11:09 pm    Post subject: Reply to: Need parts of 2 files written to 1 file no matchin
Reply with quote

Ed Groneman,

Create 2 symbols from infile1 to be used in the next step to extract the data from file2.

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
3210 5569260001718674 6423 CHANNEL ST ORANGE RIVER, DE               
//SORTOUT  DD DSN=&&S1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                                     
  OPTION COPY,STOPAFT=1                                             
  OUTFIL BUILD=(C'VAR1,C''',1,4,C'''',/,                             
                C'VAR2,C''',23,34,C'''',/,80:X)                     
/*                                                                   
//STEP0200 EXEC PGM=SORT                                             
//SYMNAMES DD DSN=&&S1,DISP=SHR                                     
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
JOHN SMITH       5569260001718672 124 ABLE DRIVE CLEVELAND, OH       
EDWARD JACKSON   5569260001718699 85 MILLER ST. CINCINNATI, OH       
MARY WILSON      5569260001718702 8 FIFTH ST. BOISE, ID             
ELDON ROGERS     5569260001718717 19 GARNETT TRAIL. KANSAS CITY, MO 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC BUILD=(1:VAR1,5:18,16,21:VAR2,800:X)                         
/*                                                                   
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 Apr 20, 2009 11:10 pm    Post subject:
Reply with quote

Ed,

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

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/800) - 1 record
//       DD DSN=...  input file2 (FB/800)
//SORTOUT DD DSN=...  output file (FB/800)
//SYSIN    DD    *
   OPTION COPY
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(801:SEQNUM,8,ZD)),
     IFTHEN=(WHEN=(801,8,ZD,EQ,1),
       BUILD=(1:1,4,21:23,35,801:801,8)),
     IFTHEN=(WHEN=NONE,BUILD=(5:18,16,801:801,8))
   OUTREC IFTHEN=(WHEN=GROUP,END=(1,1,CH,NE,1,1,CH),
     PUSH=(1:1,4,21:21,35))
   OUTFIL STARTREC=2,BUILD=(1,800)
/*
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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