Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to change inrec record & write to outrec in syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to change inrec record & write to outrec in syncsort
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: 2285
Location: @my desk

PostPosted: Wed Aug 12, 2009 7:15 pm    Post subject:
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    Post subject: Reply to: How to change inrec record & write to outrec i
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: 2285
Location: @my desk

PostPosted: Thu Aug 13, 2009 1:39 pm    Post subject:
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    Post subject: Reply to: How to change inrec record & write to outrec i
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    Post subject: Reply to: How to change inrec record & write to outrec i
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Jan 13, 2012 8:33 pm    Post subject: Reply to: How to change inrec record & write to outrec i
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us