Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replacing values from specified locations in a dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Replacing values from specified locations in a dataset
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: 1452
Location: Chicago, IL

PostPosted: Sat Aug 27, 2005 4:11 pm    Post subject: Re: Replacing values from specified locations in a dataset
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 Moderator


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

PostPosted: Sat Aug 27, 2005 9:10 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


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

PostPosted: Sun Aug 28, 2005 10:31 am    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject:
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 Moderator


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

PostPosted: Mon Aug 29, 2005 8:34 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Aug 30, 2005 8:37 pm    Post subject:
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    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject:
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 Moderator


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

PostPosted: Fri Sep 23, 2005 2:45 am    Post subject:
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    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject: Re: Replacing values from specified locations in a dataset
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    Post subject:
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 Moderator


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

PostPosted: Fri Oct 14, 2005 8:16 pm    Post subject:
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:

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Want to pull the job log into a Mainf... Jishu Mukherjee Compuware & Other Tools 9 Tue Mar 21, 2017 4:48 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts JCL to get submitted once dataset has... vinu78 JCL & VSAM 17 Thu Feb 16, 2017 7:32 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us