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

How to change inrec record & write to outrec in syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Wed Aug 12, 2009 6:24 pm
Reply with quote

Hi,

I would like to convert the following eztrieve condition in to syncsort(Ver 1.2.3).

Code:
IF VAR3 EQ ' ' '00000'
MOVE '00000' TO VAR3
PUT OUTTAPE FROM INTAPE
ELSE
MOVE '000000000' TO VAR2
PUT OUTTAPE FROM INTAPE
END-IF


INTAPE is the input file recrd of length 1904 characters. Both Input & output files are VB.

For test purpose, I tried to change only 1 character with the below sort cards, but throws outrec syntax error.

OUTREC IFTHEN=(WHEN=(1,4,20,1,CH,EQ,C'B'),OVERLAY(20:C'X'))
SORT FIELDS=COPY

Please suggest some methods for the above problem.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 12, 2009 7:15 pm
Reply with quote

cvijay784,

Try correcting the syntax of IFTHEN statment by changing the below part
Code:
OUTREC IFTHEN=(WHEN=(1,4,20,1,CH,EQ,C'B'),OVERLAY(20:C'X'))
as
Code:
OUTREC IFTHEN=(WHEN=(20,1,CH,EQ,C'B'),OVERLAY=(20:C'X'))
If you still face errors, post the complete SYSOUT here.
Back to top
View user's profile Send private message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Thu Aug 13, 2009 12:38 pm
Reply with quote

Hi,

Thanks for your suggestion. It works fine and the inrec record was changed and written on sortout file.

I would like to get one more info from you i.e. if the given condition IFTHEN fails, another set of action(change someother field in the inrec if the IFTHEN fails) should be processed similar to ELSE part. Please update me with your ideas.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 13, 2009 1:39 pm
Reply with quote

Quote:
if the given condition IFTHEN fails, another set of action(change someother field in the inrec if the IFTHEN fails) should be processed similar to ELSE part. Please update me with your ideas.
You can code multiple IFTHEN's in a single INREC/OUTREC statement. If the first condition fails, it'll check for the second and so on.
Back to top
View user's profile Send private message
CHANCHAL

New User


Joined: 14 May 2008
Posts: 2
Location: pune

PostPosted: Fri Jan 13, 2012 7:02 pm
Reply with quote

I need to do same but my data is packed decimal. Please help me

example

Account # Date
PD-- 5 byte PD--- 4 byte
YYMMDD
123456781 130212
123456782 130212
123456783 130212
123456784 130212
123456785 130212
123456786 130212

I want to replace YY in date with '11' for account # 123456784

How to achieve this?

I tried below 2 sort card but could not get results
---------------------------------------------------------
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(15,5,PD,EQ,100536732),
OVERLAY=(25:+11,TO=PD,LENGTH=2))
END

---------------------------------------------------------

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(15,5,PD,EQ,100536732),
OVERLAY=(26:+11))
END
Back to top
View user's profile Send private message
CHANCHAL

New User


Joined: 14 May 2008
Posts: 2
Location: pune

PostPosted: Fri Jan 13, 2012 7:04 pm
Reply with quote

SORT does not match with example I gave, but is actual one according to my actual file layout. Please refer it only as syntax
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jan 13, 2012 8:33 pm
Reply with quote

You want to change a date, in the format DDMMYY, which is stored in a four-byte packed-decimal field?

That would be

Code:

0130212C

or

0130212F


The two-byte packed-decimal you are trying to splat over the end of your date looks like this:

Code:
011C


Which is going to destroy your dd part of the date.

If you are more exact about what you are trying to change, then you might get some answers. For instance, if all the dates are for 2012 and you want them (for some reason) to be 2011, in the format you have shown in your data, you could just subtract one from the date.

Please don't tailgate an old topic, but start a new one for your own question next time.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top