View previous topic :: View next topic
|
Author |
Message |
cvijay784 Warnings : 1 New User
Joined: 18 Jun 2008 Posts: 54 Location: Colombo
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
cvijay784 Warnings : 1 New User
Joined: 18 Jun 2008 Posts: 54 Location: Colombo
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
CHANCHAL
New User
Joined: 14 May 2008 Posts: 2 Location: pune
|
|
|
|
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 |
|
|
CHANCHAL
New User
Joined: 14 May 2008 Posts: 2 Location: pune
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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:
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 |
|
|
|