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

Making File3 out of File1 and File2 data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Sat Aug 19, 2006 6:52 pm
Reply with quote

Hi,

I have a file FILE1 having the following records:

Code:
variable1
variable2
variable3
variable4
variable5


and I have a file FILE2 having the following records:

Code:
ws-variable1
ws-variable2
ws-variable3
ws-variable4
ws-variable5


I need a file FILE3 to be made out of the above files as below:

Code:
MOVE variable1
          TO ws-variable1
MOVE variable2
          TO ws-variable2
MOVE variable3
          TO ws-variable3
MOVE variable4
          TO ws-variable4
MOVE variable5
          TO ws-variable5


Assume maximum length of a records in FILE1 and FILE2 is 50. and LRECL of FILE3 is 80.

Can someone help me doing this using DFSORT? Thanks..
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: Sat Aug 19, 2006 8:02 pm
Reply with quote

Do 'variable1', 'variable2', ... and 'ws-variable1', 'ws-variable2', ... actually appear in the records as shown? If not, what does the actual data in the records look like?
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Sat Aug 19, 2006 8:09 pm
Reply with quote

The records in FILE1 might look like,

Name
Address
City
Phone

and the records in FILE2 might look like,

Emp-Name
Emp-Address
Emp-City
Emp-Phone
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: Sun Aug 20, 2006 8:34 pm
Reply with quote

If the records in file2 all have the identifier 'Emp-' (or any other identifier) and the records in file1 don't, then you can use a one-pass DFSORT job like this to do what you asked for:

Code:

//S1 EXEC PGM=ICEMAN                                               
//SYSOUT DD SYSOUT=*                                               
//SORTIN DD DSN=...  input file1 (FB/50)                             
//       DD DSN=...  input file2 (FB/50)                               
//SORTOUT DD DSN=...  output file (FB/80)                             
//SYSIN DD *                                                       
  INREC IFTHEN=(WHEN=(1,4,CH,NE,C'Emp-'),                         
          BUILD=(C'MOVE ',1,9,81:SEQNUM,8,ZD,START=0,INCR=2)),     
        IFTHEN=(WHEN=NONE,                                         
          BUILD=(11:C'TO ',1,12,81:SEQNUM,8,ZD,START=1,INCR=2))   
  SORT FIELDS=(81,8,ZD,A)                                         
  OUTREC FIELDS=(1,80)                                             
/*                                                                 


If, however, there really is no way to identify which file a record comes from, then you'd need to use a three-pass DFSORT/ICETOOL job like this to do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/50)
//IN2 DD DSN=...  input file2 (FB/50)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SORT FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(C'MOVE ',1,9,81:SEQNUM,8,ZD,START=0,INCR=2)
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(11:C'TO ',1,12,81:SEQNUM,8,ZD,START=1,INCR=2)
/*
//CTL3CNTL DD *
  SORT FIELDS=(81,8,ZD,A)
  OUTREC FIELDS=(1,80)
/*
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Mon Aug 21, 2006 2:15 pm
Reply with quote

Thanks Frank.

The second solution works fine. But I am getting syntax error with the first solution. May be, version installed in my shop, doesnt support IFTHEN statements.


I am pasting the error message here.

Code:
1 SYNCSORT FOR Z/OS  1.1DR   TPF3A  U.S. PATENTS: 4210961, 5117495  (C) 2002 SYNCSORT INC.  DATE=2006/233 
                                                        z/OS   1.6.0
  SYSIN :
       INREC IFTHEN=(WHEN=(1,4,CH,NE,C'Emp-'),
             *
               BUILD=(C'MOVE ',1,9,81:SEQNUM,8,ZD,START=0,INCR=2)),
             IFTHEN=(WHEN=NONE,
               BUILD=(11:C'TO ',1,12,81:SEQNUM,8,ZD,START=1,INCR=2))
       SORT FIELDS=(81,8,ZD,A)
       OUTREC FIELDS=(1,80)
  WER903I  SYNCSORT 1.1 TPF3A IS NOT LICENSED FOR SERIAL 21BF9, TYPE 2064 116, LPAR 2, MSU 441.
  WER903I  SYNCSORT WILL STOP WORKING IN  30 DAYS UNLESS A VALID KEY IS INSTALLED.
  WER268A  INREC STATEMENT   : SYNTAX ERROR
  WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
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 Aug 21, 2006 8:46 pm
Reply with quote

The WER messages indicate you're using Syncsort, not DFSORT. Both jobs work fine with DFSORT.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top