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
 

 

Making File3 out of File1 and File2 data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Making File3 out of File1 and File2 data
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 Moderator


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

PostPosted: Sat Aug 19, 2006 8:02 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Sun Aug 20, 2006 8:34 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Aug 21, 2006 8:46 pm    Post subject:
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    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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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