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

can DFSORT change a string with a relation in a second file


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

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Thu Dec 06, 2007 1:17 pm
Reply with quote

hi,

i have files with USERID's in any position.

I have a second file( 1500 records) with a relation between this USERID and a unique ID
like this
ISERA2 UWE123
ISERA1 UFG456
....

I want to change the USERID in the first file to the corelated unique ID( from the second file)

Is it possible to do this with DFSORT ?

Andreas
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Dec 06, 2007 1:19 pm
Reply with quote

Andreas,

Please explain your requirement bit clearly with examples (i/p and o/P)
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Thu Dec 06, 2007 1:28 pm
Reply with quote

hi ,

for example:

first file before sort:
..
041 3001 3001 GSLHHJ.....000000000002100100000000002
041 3001 3001 GSLHRR.....000000000004100100200205282
041 9001 9001 GSM1KL.....000000000002100101200701022
041 9001 9001 GSM4GL.....000000000002100100000000002
..
second file:
..
GSLHHJ UER345
GSLHRR URF567
GSM1KL UCD234
GSM4GL URE765
..

after DFSORT i want to have the following:

..
041 3001 3001 UER345.....000000000002100100000000002
041 3001 3001 URF567.....000000000004100100200205282
041 9001 9001 UCD234.....000000000002100101200701022
041 9001 9001 URE765.....000000000002100100000000002
..

Is ist claer now, wat i want to do ?

Andreas
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Dec 06, 2007 2:45 pm
Reply with quote

Andreas,

Try this -

Code:

//S@  EXEC PGM=ICETOOL                                 
//DFSMSG  DD SYSOUT=*                                   
//TOOLMSG DD SYSOUT=*                                   
//FILE1 DD *                                           
----+----1----+----2----+----3----+----4----+----5----+-
041 3001 3001 GSLHHJ.....000000000002100100000000002   
041 3001 3001 GSLHRR.....000000000004100100200205282   
041 9001 9001 GSM1KL.....000000000002100101200701022   
041 9001 9001 GSM4GL.....000000000002100100000000002   
/*                                                     
//FILE2 DD *                                           
GSLHHJ UER345                                           
GSLHRR URF567                                           
GSM1KL UCD234                                           
GSM4GL URE765                                           
/*                                                     
//T1 DD DSN=&&TEMP1,DISP=(MOD,PASS)                     
//T2 DD DSN=&&TEMP2,DISP=(MOD,PASS)                                           
//OUTPUT DD SYSOUT=*                                               
//TOOLIN DD *                                                     
  COPY FROM(FILE1) TO(T1)                                         
  COPY FROM(FILE2) TO(T1) USING(CTL2)                             
  SPLICE FROM(T1) TO(T2) ON(15,6,CH) WITH(55,6) USING(CTL3)       
  COPY FROM(T2) TO(OUTPUT) USING(CTL4)                             
/*                                                                 
//CTL2CNTL DD *                                                   
  OUTREC BUILD=(15:1,6,55:8,6)                                     
/*                                                                 
//CTL3CNTL DD *                                                   
   OUTFIL FNAMES=T2,OVERLAY=(15:55,6)                             
/*                                                                 
//CTL4CNTL DD *                                                   
  OUTREC BUILD=(1,52)                                             
/*                                                                 


o/p:

Code:
----+----1----+----2----+----3----+----4----+----5--
***************************** Top of Data **********
041 3001 3001 UER345.....000000000002100100000000002
041 3001 3001 URF567.....000000000004100100200205282
041 9001 9001 UCD234.....000000000002100101200701022
041 9001 9001 URE765.....000000000002100100000000002
**************************** Bottom of Data ********


Customize sort card according to yoru req.
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Thu Dec 06, 2007 3:26 pm
Reply with quote

hi murmohk1,

thank you for your help, it helps only a bit....

Here the correct sample.
first file before sort:
..
041 3001 3001 GSLHHJ.....000000000002100100000000002
041 3001 3001 GSLHRR.....000000000004100100200205282
041 9001 9001 GSM1KL.....000000000002100101200701022
041 9001 9001 GSM4GL.....000000000002100100000000002
041 3001 3001 GSLHHJ.....000000000002100100000000002
041 9001 9001 GSM1KL.....000000000002100101200701022
..
second file:
..
GSLHHJ UER345
GSLHRR URF567
GSM1KL UCD234
GSM4GL URE765
GSM4KK UDE745
ISERA2 UUW165
..

after DFSORT i want to have the following:

..
041 3001 3001 UER345.....000000000002100100000000002
041 3001 3001 URF567.....000000000004100100200205282
041 9001 9001 UCD234.....000000000002100101200701022
041 3001 3001 UER345.....000000000002100100000000002
041 9001 9001 URE765.....000000000002100100000000002
041 3001 3001 URF567.....000000000004100100200205282
..

In file2 there is one record for each USERID.

In file1 there can be no or one or more records with this USERID.
You know what i mean ?

As result i want to have the records from file1 with the recoded USERID.

Andreas
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: Thu Dec 06, 2007 10:19 pm
Reply with quote

Andreas,

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately. The seqnum and the last SORT operator are needed to put the output records back in their original file1 order.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(89,6,CH) -
  WITHALL WITH(1,14) WITH(21,68)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(15:8,6,89:1,6)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,PD,89:15,6)
/*
//CTL3CNTL DD *
  SORT FIELDS=(81,8,PD,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Fri Dec 07, 2007 11:23 am
Reply with quote

Hi Frank,

thank you for your help.

I have one more question.

I have a USERID in file1 but not in file2.
If i use the current job this record will not be in the output file.
It is possible to take this record unmodified in the output file ?

Here is the sample:

Here the correct sample.
first file before sort:
..
041 3001 3001 GSLHHJ.....000000000002100100000000002
041 3001 3001 GSLHRR.....000000000004100100200205282
041 9001 9001 GSM1KL.....000000000002100101200701022
041 9001 9001 GSM4GL.....000000000002100100000000002
041 3001 3001 GSLHHJ.....000000000002100100000000002
041 9001 9001 TSM1KL.....000000000002100101200701022
..
second file:
..
GSLHHJ UER345
GSLHRR URF567
GSM1KL UCD234
GSM4GL URE765
GSM4KK UDE745
ISERA2 UUW165
..

after DFSORT i want to have the following:

..
041 3001 3001 UER345.....000000000002100100000000002
041 3001 3001 URF567.....000000000004100100200205282
041 9001 9001 UCD234.....000000000002100101200701022
041 9001 9001 URE765.....000000000002100100000000002
041 3001 3001 UER345.....000000000002100100000000002
041 9001 9001 TSM1KL.....000000000002100101200701022
..
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: Fri Dec 07, 2007 10:00 pm
Reply with quote

You can use a DFSORT/ICETOOL job like this for your new requirement:

Code:

//S2    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(89,6,CH) KEEPNODUPS -
  WITHALL WITH(1,14) WITH(21,68)
SORT FROM(T2) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(15:8,6,89:1,6)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,PD,89:15,6)
/*
//CTL3CNTL DD *
  SORT FIELDS=(81,8,PD,A)
  OUTFIL FNAMES=OUT,OMIT=(81,1,CH,EQ,C' '),
   BUILD=(1,80)
/*
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Mon Dec 10, 2007 4:14 pm
Reply with quote

hi Frank,

thank you for the files with FB 80 it works....

Now i want to use the same with a inputfile of FB 202 where the userid is located in position 40 ( length 6)

I tried this:

Code:

//S2    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/202)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/202)
//TOOLIN DD *                                                         
COPY FROM(IN2) TO(T1) USING(CTL1)                                     
COPY FROM(IN1) TO(T1) USING(CTL2)                                     
SPLICE FROM(T1) TO(T2) ON(211,6,CH) KEEPNODUPS -                       
  WITHALL WITH(1,39) WITH(46,165)                                     
SORT FROM(T2) USING(CTL3)                                             
/*                                                                     
//CTL1CNTL DD *                                                       
  INREC BUILD=(40:8,6,211:1,6)                                         
/*                                                                     
//CTL2CNTL DD *                                                       
  INREC OVERLAY=(203:SEQNUM,8,PD,211:40,6)                             
/*                                                                     
//CTL3CNTL DD *                                                       
  SORT FIELDS=(203,8,PD,A)                                             
  OUTFIL FNAMES=OUT,OMIT=(203,1,CH,EQ,C' '),                           
  BUILD=(1,202)                                                       
/*     


But it dosnt work.
I missed a few of records from the input file in the output.

What is the error i made from changing from
FB 80 -> FB 202 and
Position 15 -> Position 40 ????

Can you help me ?

Andreas
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Mon Dec 10, 2007 4:49 pm
Reply with quote

I modified the input file from the first example and i use your last ICETOOL statments:

here is the new:
041 3001 3001 GXLHHJ.....000000000002100100000000001 00000110
041 3001 3001 GXLHHJ.....000000000002100100000000002 00000120
041 3001 3001 GXLHHJ.....000000000002100100000000003 00000130
041 3001 3001 GXLHHJ.....000000000002100100000000004 00000140
041 3001 3001 GSLHHJ.....000000000002100100000000002 00000150
041 3001 3001 GSLHRR.....000000000004100100200205282 00000200
041 9001 9001 GSM1KL.....000000000002100101200701022 00000300
041 9001 9001 GSM4GL.....000000000002100100000000002 00000400
041 3001 3001 GSLHHJ.....000000000002100100000000003 00000500
041 3001 3001 XSLHHJ.....000000000002100100000000003 00000510
041 3001 3001 GSLHRR.....000000000004100100200205282 00000600
041 3001 3001 TSLHRR.....000000000004100100200205282 00000700
041 3001 3001 SSLHRR.....000000000004100100200205282 00000800
041 3001 3001 ESLHRR.....000000000004100100200205282 00000900
041 3001 3001 ZSLHRR.....000000000004100100200205282 00001000
041 3001 3001 USLHRR.....000000000004100100200205282 00001100

and here is the output:
041 3001 3001 GXLHHJ.....000000000002100100000000002 00000120
041 3001 3001 GXLHHJ.....000000000002100100000000003 00000130
041 3001 3001 GXLHHJ.....000000000002100100000000004 00000140
041 3001 3001 UER345.....000000000002100100000000002 00000150
041 3001 3001 URF567.....000000000004100100200205282 00000200
041 9001 9001 UCD234.....000000000002100101200701022 00000300
041 9001 9001 URE765.....000000000002100100000000002 00000400
041 3001 3001 UER345.....000000000002100100000000003 00000500
041 3001 3001 XSLHHJ.....000000000002100100000000003 00000510
041 3001 3001 URF567.....000000000004100100200205282 00000600
041 3001 3001 TSLHRR.....000000000004100100200205282 00000700
041 3001 3001 SSLHRR.....000000000004100100200205282 00000800
041 3001 3001 ESLHRR.....000000000004100100200205282 00000900
041 3001 3001 ZSLHRR.....000000000004100100200205282 00001000
041 3001 3001 USLHRR.....000000000004100100200205282 00001100

The first record from the input is missing... why ????
Back to top
View user's profile Send private message
ajaehnert

New User


Joined: 05 Dec 2007
Posts: 13
Location: Germany

PostPosted: Mon Dec 10, 2007 5:49 pm
Reply with quote

hi frank,

i found what the problem is:

for the non-machting records the firts record will deleted.

the option KEEPNODUPS says that non-machting records will be not deleted.

Is there a problem with this option ?

Andreas
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 Dec 10, 2007 10:26 pm
Reply with quote

You changed the requirement. Now you have duplicate records in file2 without a match in file1. To handle that, you need to add KEEPBASE to the SPLICE operator:

Code:

SPLICE FROM(T1) TO(T2) ON(211,6,CH) KEEPNODUPS KEEPBASE -   
  WITHALL WITH(1,39) WITH(46,165)                           
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 6
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top