|
View previous topic :: View next topic
|
| Author |
Message |
nickyboy
New User
.jpg)
Joined: 26 Aug 2005 Posts: 16
|
|
|
|
Hi,
I want to write a JCL which will make a copy of my variable length dataset with the following changes,
For all records with some specific value at a particular position (say 100 at position starting from 12 ) , the values from position 45 to 50 is to be replaces with XXXXXX
For all the remaining records there should not be any changes .
Could anyone please help me out on this.
Thanks,
Nick |
|
| Back to top |
|
 |
priyesh.agrawal
Senior Member

Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hello Nick,
You suppose to give Record Length of your Input File. Well, I assumed it 80 here.
| Code: |
//STEP EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=RECORDS.INPUT,DISP=SHR
//SORTOUT DD DSN=RECORDS.OUT,
// DISP=(,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(12,3,CH,EQ,C'100'),
BUILD=(1,44,45:C'XXXXXX',51,30))
/* |
This DFSORT job will do exactly, what you are looking for...If any prob, do get back.
Regards,
Priyesh. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Actually, this DFSORT job is a better way to do it then the one shown by Priyesh since with OVERLAY, you just specify the field you want to replace, whereas with BUILD you must specify the fields before and after it as well.
| Code: |
//STEP EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(12,3,CH,EQ,C'100'),
OVERLAY=(45:C'XXXXXX'))
/*
|
Either way, you'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN function. Only DFSORT has this function, so if you don't have DFSORT, you won't be able to use it. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
Use [URL] BBCode for External Links |
|
| Back to top |
|
 |
priyesh.agrawal
Senior Member

Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Thats where an EXPERT come into frame....
Thanks for updating Frank.....I learn a new thing......
Regards,
Priyesh. |
|
| Back to top |
|
 |
nickyboy
New User
.jpg)
Joined: 26 Aug 2005 Posts: 16
|
|
|
|
Thanks Priyesh and Frank for your replies..
I forgot to tell about the type of the input file.
My input file is a variable length file not a FB of 80 chars.
Please help me out..
Thanks,
Nick |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Nick,
The DFSORT OVERLAY job I showed you will work for VB files. However, if you didn't count the 4-byte RDW in positions 1-4 when you gave the starting positions (12 and 45), then you need to add 4 to each starting position (16 and 49):
| Code: |
//STEP EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(16,3,CH,EQ,C'100'),
OVERLAY=(49:C'XXXXXX'))
/*
|
|
|
| Back to top |
|
 |
nickyboy
New User
.jpg)
Joined: 26 Aug 2005 Posts: 16
|
|
|
|
Thanks Frank for updating me on the same..
Could you please tell me how this OVERLAY part is to be modified such that ,
1) I should be able to specify the length of the data to be replaced. ( eg : starting from position 45 , 10 positions are replaced )
2) Also if I enter the length as 10 and specifying the new value as XX only, it should replace with XX and eight spaces.
Thanks in advance,
Nick. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you want a constant of 'XX' followed by 8 blanks, you can do that in a couple of ways:
| Code: |
OVERLAY=(49:C'XXbbbbbbbb'))
|
where each b is a blank, or:
| Code: |
OVERLAY=(49:C'XX',8X))
|
|
|
| Back to top |
|
 |
leo_sangha
New User

Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
Somehow i am getting SYNTAX Error when i use the JCL provided by Frank in his reply.
We have DFSORT installed in our shop ... i wonder what could be reason
this is what i have tried ....
//STEP EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,
// DISP=(,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(17,2,CH,EQ,C'28'),
OVERLAY=(17:C'41'))
/*
i wanted to replace all the fields starting at position 17 having values 28
to 41 in all the records ....
Can you please help me out in this case ?????
I have a quick Question what if the concerned field is Zoned Decimal will the same JCL Work ..... |
|
| Back to top |
|
 |
leo_sangha
New User

Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
this is the exact error i am getting somehow i am not able to figure out what`s wrong ....
PRODUCT LICENSED FOR CPU SERIAL NUMBER 1366A, MODEL 2064 1C5 LICEN
SYSIN :
OPTION COPY 0009001
OUTREC IFTHEN=(WHEN=(17,2,CH,EQ,C'28'), 0010001
*
OVERLAY=(17:C'41')) 0011001
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000 |
|
| Back to top |
|
 |
Kevin
Active User

Joined: 25 Aug 2005 Posts: 234
|
|
|
|
| Quote: |
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
|
These are SYNCSORT error messages. Your other post says that you have DFSORT installed. I beg to differ. |
|
| Back to top |
|
 |
Rama Nelluri
New User
Joined: 16 Sep 2005 Posts: 6
|
|
|
|
Hi,
You can do above changes in JCL with Change command. before using change stmt if the required filed is Packed decimal then need to unpack the packed decimal to numeric value using 'PD'.
Syntax for unpacking data:
OUTREC=(917,7,PD,EDIT=(STTTTTTT.TTTTT),SIGNS=(,-))
Ex: If the input field is PIC S9(7)V9(5) Comp-3. Assume it starts in 917 the position in the Input file. And the mention the length of this Comp-3 filed in next position. Here it is 7 bytes. S: is used for to notify this is Signed Data.
Syntax for Change Command:
SORT FIELDS=COPY
OUTREC FIELDS=(1,4,
5,8,
CHANGE=(8,C' ',C'12345678',
C'88888888',C' ',
C'00000000',C'99999999'),NOMATCH=(5,8))
here i just given for length of file 8. here iam changing the data in 5th position to whatever i required.
Regards,
Rama.N |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Leo,
As Kevin pointed out, you're using Syncsort, not DFSORT. Your job works fine with DFSORT. But unlike DFSORT, Syncsort does NOT support IFTHEN or OVERLAY so you get an error message.
| Quote: |
| have a quick Question what if the concerned field is Zoned Decimal will the same JCL Work ..... |
If 17-18 has a ZD value, you could use the following with DFSORT (but obviously not with Syncsort):
WHEN=(17,2,ZD,EQ,+28), |
|
| Back to top |
|
 |
leo_sangha
New User

Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
Yes i was not sure about this earlier,
Thanks a lot for your help. |
|
| Back to top |
|
 |
nickyboy
New User
.jpg)
Joined: 26 Aug 2005 Posts: 16
|
|
|
|
Could anybody please help me for the case where the OVERLAY is to be done only after more than one checking. That means I wanted to have more than one condition in a single WHEN statement. Please tell me the syntax for this.
I tried as follows..but i am getting syntax error
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C'0010'),
(8,4,CH,EQ,C'0020'),
OVERLAY=(15:C'1201'))
Thanks,
Nick. |
|
| Back to top |
|
 |
MGIndaco
Active User

Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I suggest you to try with this form:
| Code: |
//SYSIN DD *
*SORT STATEMENT START AT POSITION 2
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C'0010',AND,8,4,CH,EQ,C'0020'),
OVERLAY=(15:C'1201')) |
I hope in this. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can code DFSORT's WHEN condition with OR and AND operators in the same way you can code the INCLUDE condition with OR and AND operators. MGIndaco has shown the correct syntax using AND which assumes that you want to do the OVERLAY if both conditions are satisfied. If you want to do the OVERLAY if either condition is satisifed, you would use:
| Code: |
OPTION COPY
OUTREC IFTHEN=(WHEN=1,4,CH,EQ,C'0010',OR,8,4,CH,EQ,C'0020'),
OVERLAY=(15:C'1201'))
/*
|
For complete details on the syntax of DFSORT's INCLUDE, OMIT and WHEN conditions, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/3.7?DT=20050222160456 |
|
| Back to top |
|
 |
nickyboy
New User
.jpg)
Joined: 26 Aug 2005 Posts: 16
|
|
|
|
Thanks Frank and MGIndaco for your repiles..This is exactly what I was looking for..
Nick.. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|