MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can I use any utilities for this requirement ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Dec 19, 2003 10:07 am    Post subject: Can I use any utilities for this requirement ? Reply with quote

Hi,
I have a file which contain a field called country-code. This has a number
associated with each country.
For example
209 : USA
33 : CANADA etc..
I have another file which has this country code and country name mapping. Instead of writing a program is it possible to change the country-code in the first file to the relevant country-name using any utilities?
Country-code field is character and has a length of 20 at position 230.
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Fri Dec 19, 2003 10:13 am    Post subject: Reply with quote

Somu,

Please provide the following details:

1. What is the LRECL, RECFM of both the files
2. Does any of the files have duplicates?
3. What is the max no: of country codes you can have.
4. Please post a sample Input data and desired output data.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Dec 19, 2003 11:32 am    Post subject: Reply with quote

Kolusu,

1.Both the files are FB.Let us call the file with country-code as FILE1 and the mapping file which is having both country-code and country-name as FILE2.
FILE1 - LRECL is 250.
FILE2-LRECL is 100.
2.FILE1 has duplicates. Since FILE2 is only a lookup table for extracting the country-name from the country-code it does not have duplicates.
3.We can have a max number of 50. But it's not in a sequence like 1,2.3,4,5 etc.
Rather some thing like 10,112,170,230 etc.

4.

Code:

Input FILE1.
-------------
1  AAA   BBBBB  CCCCC    DDDDDD    100
2  AAA   BBBBB  CCCCC    DDDDDD    11
3  AAA   BBBBB  CCCCC    DDDDDD    10
4  AAA   BBBBB  CCCCC    DDDDDD    111
5  AAA   BBBBB  CCCCC    DDDDDD    100
6  AAA   BBBBB  CCCCC    DDDDDD    111

Input FILE2.
-------------
1  10      AUSTRALIA
2  11      AUSTRIA
3  33      CANADA
4  100    GERMANY
5  111     FINLAND

Desired Output.
-------------
1  AAA   BBBBB  CCCCC    DDDDDD    GERMANY
2  AAA   BBBBB  CCCCC    DDDDDD    AUSTRIA
3  AAA   BBBBB  CCCCC    DDDDDD    AUSTRALIA
4  AAA   BBBBB  CCCCC    DDDDDD    FINLAND
5  AAA   BBBBB  CCCCC    DDDDDD    GERMANY
6  AAA   BBBBB  CCCCC    DDDDDD    FINLAND

_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Fri Dec 19, 2003 12:11 pm    Post subject: Reply with quote

Somu,

The following DFSORT/ICETOOL JCL will give you the desired results. If your shop has syncsort then change the pgm name to synctool.

A brief explanation of the job. The first copy operator takes in the country code look up file and creates a change cards

We take that change card file and update the country codes in file1. we add a true and false condition for the syntax.

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//OUT      DD SYSOUT=*                                         
//IN1      DD DSN=YOUR 250 BYTE FILE,
//            DISP=SHR
//IN2      DD *                                               
1  10 AUSTRALIA                                               
2  11 AUSTRIA                                                 
3  33 CANADA                                                   
4 100 GERMANY                                                 
5 111 FINLAND                                                 
//C2       DD DSN=&C2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)     
//TOOLIN   DD *                                               
  COPY FROM(IN2) USING(CTL1)                                   
  COPY FROM(IN1) USING(CTL2)                                   
//CTL1CNTL DD *                                               
  OUTFIL FNAMES=C2,                                             
  OUTREC=(22X,C'C',X'7D',3,3,X'7D',C',C''',7,20,X'7D',C',',80:X)
//CTL2CNTL DD *                                               
  OUTFIL FNAMES=OUT,                                           
  OUTREC=(1,229,230,3,CHANGE=(20,C'ABC',C'TRUE CONDITION      ',
//         DD DSN=&C2,DISP=OLD,VOL=REF=*.C2                   
//         DD *                                               
                               C'XYZ',C'FALSE CONDITION     '),
                               NOMATCH=(230,3))
//*                                                           



The control cards generated from the first copy operator will be as follows:
Code:

C' 10',C'AUSTRALIA           ',       
C' 11',C'AUSTRIA             ',       
C' 33',C'CANADA              ',       
C'100',C'GERMANY             ',       
C'111',C'FINLAND             ',       



Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Fri Dec 19, 2003 1:07 pm    Post subject: Reply with quote

Somu,
Here is an alternative solution using easytrieve. Here we are using the features like TABLE and search. This is similar to a table search in cobol

Code:

//STEP0100 EXEC PGM=EZTPA00                         
//STEPLIB  DD DSN=EASYTREV.LOADLIB,       
//            DISP=SHR                             
//EZTVFM   DD UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE)   
//SYSPRINT DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SYSSNAP  DD SYSOUT=*                             
//SYSUDUMP DD SYSOUT=*                             
//IN1      DD *                                     
1 AAA BBBBB CCCCC DDDDDD 100                       
2 AAA BBBBB CCCCC DDDDDD  11                       
3 AAA BBBBB CCCCC DDDDDD  10                       
4 AAA BBBBB CCCCC DDDDDD 111                       
5 AAA BBBBB CCCCC DDDDDD 100                       
6 AAA BBBBB CCCCC DDDDDD 111                       
//IN2      DD *                                     
1  10 AUSTRALIA                                     
2  11 AUSTRIA                                       
3  33 CANADA                                       
4 100 GERMANY                                       
5 111 FINLAND                                       
//OUTFILE  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),                             
//            DCB=(LRECL=250,RECFM=FB,BLKSIZE=0)     
//SYSIN    DD *             
                                                                     
 FILE IN1                                                             
      IN1-REC               001 229  A                                 
      IN1-CODE              230 003  A                                 
                                                                     
 FILE IN2 TABLE                                                       
      ARG                   003 003  A                                 
      DESC                  007 020  A                                 
                                                                     
                                                                     
 FILE OUTFILE FB(0 0)                                                 
      OUT-REC               001 229  A                                 
      OUT-CODE              230 020  A                                 
                                                                     
 W-SEARCH-CODE               W  03 A                                 
 W-COUNTRY-NAME              W  20 A                                 
                                                                     
**********************************************************************
* PROCESSES AREA                                                     
**********************************************************************
                                                                     
 JOB INPUT IN1                                                       
                                                                     
     W-SEARCH-CODE   = IN1-CODE                                       
     W-COUNTRY-NAME  = ' '                                           
     SEARCH IN2 WITH W-SEARCH-CODE, GIVING W-COUNTRY-NAME             
                                                                     
     OUT-REC           =  IN1-REC                                     
     OUT-CODE          =  W-COUNTRY-NAME                             
     PUT OUTFILE


Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Dec 19, 2003 2:12 pm    Post subject: Reply with quote

Somu,

Here's a DFSORT/ICETOOL job that uses the SPLICE operator to do what you want. It will work for any number of records. I've assumed you want the output data set to have LRECL=250, but you can adjust the job for any LRECL you want.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file2
//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
//TOOLIN DD *
* REFORMAT FILE1
  COPY FROM(IN1) TO(T1) USING(CTL1)
* REFORMAT FILE2
  COPY FROM(IN2) TO(T1) USING(CTL2)
* SPLICE FILE1/FILE2 ON KEY IN 50 AND COMBINE FIELDS
  SPLICE FROM(T1) TO(T2) ON(50,3,CH) WITHALL WITH(1,35)
* SORT OUTPUT BACK INTO ORIGINAL ORDER AND REMOVE KEY
  SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,35,     COPY DATA FROM FILE1
                 50:36,3)  PUT KEY AT 50
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(36:12,10, PUT COUNTRY AT 36
                 50:4,3)   PUT KEY AT 50
/*
//CTL3CNTL DD *
  SORT FIELDS=(1,1,CH,A)   PUT BACK IN ORIGINAL ORDER
  OUTREC FIELDS=(1,45,250:X)   REMOVE THE KEY AND PAD TO LRECL
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Thu May 19, 2005 3:13 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Dec 19, 2003 2:15 pm    Post subject: Reply with quote

Thanks Kolusu. But there is a small change.
The position of the country code in FILE-1 is 757 and length is 40.Can you pl tell me what are the changes do I need to do in the JCL.?
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Fri Dec 19, 2003 2:53 pm    Post subject: Reply with quote

Somu,

Assuming that the country name in the look up file is still 20 bytes, the only change you need is in CTL2CNTL. change your CTL2CNTL to the following.
Code:

//CTL2CNTL DD *                                               
  OUTFIL FNAMES=OUT,                                           
  OUTREC=(1,756,757,3,CHANGE=(20,C'ABC',C'TRUE CONDITION      ',
//         DD DSN=&C2,DISP=OLD,VOL=REF=*.C2                   
//         DD *                                               
                               C'XYZ',C'FALSE CONDITION     '),
                               NOMATCH=(757,3),20X)
//*                                                           


Hope this helps..

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Dec 19, 2003 5:02 pm    Post subject: Reply with quote

Thanks Kolusu..
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Mar 31, 2004 9:10 am    Post subject: Reply with quote

Hi Yaeger,
In our shop we are using ICETOOL. But SPLICE operator is not working.
Could you please let me know any other option instead of SPLICE.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Wed Mar 31, 2004 9:13 am    Post subject: Reply with quote

vkphani,

Whenever you say a particular feature is not working then you need to post the error messages(toolmsg & dfsmsg) from the sysout. If your shop has syncsort then many of the features of DFSORT's ICETOOL are not supported by Syncsort's synctool. On the other hand if your shop do have DFSORT's ICETOOL then you need to upgrade to the latest ptf. The latest ptf has all the goodies , so you need to talk to your systems programmer about upgrading. Please stop posting in all the topics that the features does not work.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 31, 2004 10:28 am    Post subject: Reply with quote

vkphani,

If you use DFSORT (ICE messages) and you are getting a "syntax" error for SPLICE, then you need to have your System Programmer install DFSORT R14 PTF UQ90053 (Feb, 2003).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Apr 01, 2004 1:28 am    Post subject: Reply with quote

Kolusu, I just tried your solution.... Its just awesome...So simple but very very effective.....


Unfortunately, we have syncsort here (that too very old version)...so, couldn't try Frank's method..(SPLICE).

Thanks,
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Apr 01, 2004 5:02 am    Post subject: Reply with quote

Kolusu,

Just wanted to confirm. Is there any restriction on the number of records in File 2 (in the above example that you have provided). B'cas I seem to get a S0C6 abend when I try to run the code with larger no. of records, but if I run the same code with 5-10 records in File 2 the job runs fine....

If there is a restriction how can we overcome that ? We do not have DFSORT here...Only Syncsort "SYT000I SYNCTOOL RELEASE 1.3A - COPYRIGHT 1999 SYNCSORT INC."

Please let me know...Thanks,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Apr 01, 2004 5:28 am    Post subject: Reply with quote

phantom,

Yes the solution is dependent on the no: of records in file2. Since we are generating dynamic change control cards , we cannot have more than 500 records. Again this no: is dependent on the size of the field also.

Hope this helps....

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group