Posted: Fri Dec 19, 2003 10:07 am Post subject: Can I use any utilities for this requirement ?
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
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Fri Dec 19, 2003 10:13 am Post subject:
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.
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.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Fri Dec 19, 2003 1:07 pm Post subject:
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
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
**********************************************************************
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Dec 19, 2003 2:12 pm Post subject:
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
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
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Wed Mar 31, 2004 9:13 am Post subject:
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.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 31, 2004 10:28 am Post subject:
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
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Thu Apr 01, 2004 5:02 am Post subject:
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."
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Apr 01, 2004 5:28 am Post subject:
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.
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