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

Replacing values from specified locations in a dataset


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

New User


Joined: 26 Aug 2005
Posts: 16

PostPosted: Sat Aug 27, 2005 2:22 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sat Aug 27, 2005 4:11 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sat Aug 27, 2005 9:10 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Aug 28, 2005 10:31 am
Reply with quote

Thats where an EXPERT come into frame....

Thanks for updating Frank.....I learn a new thing......

Regards,

Priyesh.
Back to top
View user's profile Send private message
nickyboy

New User


Joined: 26 Aug 2005
Posts: 16

PostPosted: Mon Aug 29, 2005 12:09 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Aug 29, 2005 8:34 pm
Reply with quote

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
View user's profile Send private message
nickyboy

New User


Joined: 26 Aug 2005
Posts: 16

PostPosted: Tue Aug 30, 2005 10:58 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Aug 30, 2005 8:37 pm
Reply with quote

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
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Mon Sep 19, 2005 7:00 pm
Reply with quote

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
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Mon Sep 19, 2005 7:03 pm
Reply with quote

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
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Mon Sep 19, 2005 7:29 pm
Reply with quote

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
View user's profile Send private message
Rama Nelluri

New User


Joined: 16 Sep 2005
Posts: 6

PostPosted: Mon Sep 19, 2005 8:09 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Sep 23, 2005 2:45 am
Reply with quote

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
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Fri Sep 23, 2005 4:52 pm
Reply with quote

Yes i was not sure about this earlier,

Thanks a lot for your help.
Back to top
View user's profile Send private message
nickyboy

New User


Joined: 26 Aug 2005
Posts: 16

PostPosted: Fri Oct 14, 2005 7:33 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Oct 14, 2005 8:03 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Oct 14, 2005 8:16 pm
Reply with quote

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
View user's profile Send private message
nickyboy

New User


Joined: 26 Aug 2005
Posts: 16

PostPosted: Mon Oct 17, 2005 3:41 pm
Reply with quote

Thanks Frank and MGIndaco for your repiles..This is exactly what I was looking for..

Nick..
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top