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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Mon Apr 20, 2009 9:46 pm
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
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
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 Developer


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

PostPosted: Mon Apr 20, 2009 11:10 pm
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 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 4
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