View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I have an input file with LRECL (267) and RECFM (FB). I am using .... here NOT to show remaining data.
Input Data:
Code: |
----+----1----+----2----+
199200 00A009 .......................................................................
199200 00A009 .......................................................................
192200 00B008 .......................................................................
|
Expected Output Data:
Code: |
199200 0001009
199200 0001009
192200 0002009
|
Whenever a 'A' is found at 10th position it should be replaced with '01' and if 'B' found should be replaced with '02' and so on....
Is using INREC with IFTHEN WHEN the only way with Syncsort or any simpler version possible? I say simpler version because it should be easy to understand and fix if a production abend occurs !
Please help.
Thanks. |
|
Back to top |
|
|
darkstar13
New User
Joined: 06 Nov 2008 Posts: 46 Location: Manila, Philippines
|
|
|
|
I think using INREC IFTHEN=(WHEN... ) command is a simple conditional statement and is already easy to understand.
However, what I don't understand is your input record. I think it should be like:
Code: |
----+----+----+
199200 00A009
199200 00B009
199200 00C009
|
and you want to have
Code: |
----+----+----+
199200 0001009
199200 0002009
199200 0003009
|
am I right? If so, then your outpur LRECL will be 268, and that records 11 to 267 will be moved to the right by 1? |
|
Back to top |
|
|
darkstar13
New User
Joined: 06 Nov 2008 Posts: 46 Location: Manila, Philippines
|
|
|
|
My mistake, your input looks ok, my screen was just not maximized. Sorry for that..
Anyway, will your expected output LRECL be 268? or the last byte be truncated? |
|
Back to top |
|
|
darkstar13
New User
Joined: 06 Nov 2008 Posts: 46 Location: Manila, Philippines
|
|
|
|
If you really dont want IFTHEN, you can use ALTSEQ:
Code: |
OPTION COPY
ALTSEQ CODE=(C1F1,
C2F2,
C3F3,
C4F4) |
Or something like that. (That logic replaces A by 1. But you can manipulate things to fit your requirement.) |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi, ET.
The output LRECL should accommodate the expanded byte also. The records always don't appear in the same incremental form. We don't receive the file in SORTed format neither we send it out to lower systems in SORTed format.
So, I am confused how to achieve it.
Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
The output LRECL should accommodate the expanded byte also. |
Does this mean the output lrecl will be one byte longer?
Quote: |
The records always don't appear in the same incremental form. |
What does this mean? Show examples of this.
Quote: |
We don't receive the file in SORTed format neither we send it out to lower systems in SORTed format. |
How does thi relate to converting the 1-position "letters" to 2-position numbers. You say "and so on" - until when?
Once you provide a better explanation of what you need to do, someone will be able to offer better suggestions. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramsri,
ALTSEQ does n't require this to be sorted in any form. The below job might help.
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+-
199200 00C009
199200 00A009
192200 00B008
199200 00A009
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(C1F1,C2F2,C3F3)
INREC FIELDS=(1,9,C'0',10,1,TRAN=ALTSEQ,11,3)
|
SORTOUT
Code: |
----+----1----+
199200 0003009
199200 0001009
192200 0002008
199200 0001009
|
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramsri,
The above job is limited to convert A-I to 1-9, but if you have alphabets beyond that, I would suggest using IFTHEN, which is easy to understand and more flexible. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
arcvns,
Thank you.
I would like to know how it takes care of adding extra byte to accommodate new LRECL. We actually use 14 values for conversion (including the obsolete ones). If I remove those obsolete entries then it comes around 9 to 10 values to be converted.
Is it the limitation of SORT that it does convert only A to I?
Thanks.[/code] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Is it the limitation of SORT that it does convert only A to I? |
No, the limit is what you code in the ALTSEQ conversion list.
Quote: |
I would like to know how it takes care of adding extra byte to accommodate new LRECL. |
In the example posted it doesn't. The input and the output are both lrecl 80. You would need to code proper jcl for the new lrecl. |
|
Back to top |
|
|
|