View previous topic :: View next topic
|
Author |
Message |
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
hi all,
Kindly go thru the attachement for the requirement.
I am not able to place here with proper alignment. So attached the requirement in the document.
Thanks. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Do NOT post attachments as not evreyone can or chooses to open them
Use cut and paste with the code tags, and having been on the forum for 6 years I would rather hope that you had learnt to use them by now
Code: |
[code]Put
Your code
Here [/code] |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
karthi_ind,
You have been a member of this forum for quite a long time. Are n't you comfortable using the "Code" tags yet??
Also your requirement does not reveal the position, length and format of all the relevant fields. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Now i had to download from usenet MS Word to read the attachment. Bill Gates is knocking on my door because that was an illegal act. Thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Peter,
"Nothing is illegal until you get caught" |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Arun Raj wrote: |
Peter,
"Nothing is illegal until you get caught" |
And proven guilty |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Code: |
Input file
Status id1 id2 id3 price qty descr
------------------------------------------------------
aa 1 1 1 10 2 xxx
aa 1 1 1 10 2 yyy
aa 1 1 1 10 2 aaa
bb 2 2 2 05 3 yyy
bb 2 2 2 05 3 aaa
Output file
Status id1 id2 id3 price qty descr
-------------------------------------------------------
aa 1 1 1 10 2 xxx
yyy
aaa
bb 2 2 2 05 3 yyy
aaa
|
Format is FB
Status - length (3), Starts in 3, type is char
id1 - length (6), starts in 17, type is numeric
id2 - length (20), starts in 33, type is char
id3 - length (10), starts in 54, type is char
price - length (7), starts in 66, type is numeric
qty - length (6), starts in 74, type is numeric
Descr - length (11), starts in 83, type is char
remaining can be spaces till the end of 120.
Please let me know if you need any other details. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
You have shown the input and the output but have not explained the rules from getting from one to the other. |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Hi expat,
The rule is
if the status, id1, id2, id3, price, qty are equal for more than one records and descr is different then it has to remove the repeated values of
status, id1, id2, id3, price, qty and has to retain descr field alone in the output file (as given in the above output file), same has to be done for all other records also.
Hope this makes clear.
Thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
if the status, id1, id2, id3, price, qty are equal for more than one records and descr is different |
What if descr is also same for multiple records? |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Hi Arun,
Descr will not be same for multiple records.
Thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
It might be worth giving this a try.
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Input file FB/252
//SORTOUT DD DSN= Output file FB/120
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(253:SEQNUM,8,ZD,RESTART=(1,82))),
IFTHEN=(WHEN=(253,8,ZD,NE,1),BUILD=(83:83,11,120:X)),IFOUTLEN=120 |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
Code: |
SORT FIELDS=COPY
INREC OVERLAY=(94:SEQNUM,8,ZD,RESTART=(1,79))
OUTREC IFTHEN=(WHEN=(94,8,ZD,GT,1),
BUILD=(82C' ',83,11)),
IFTHEN=(WHEN=(94,8,ZD,EQ,1),
BUILD=(1,93,120:X))
|
Gerry |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi Gerry,
Does n't the above card have an additional OUTREC pass? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Arun,
yes, you are right
Gerry |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Thanks Arun and Gerry.
The code is working pretty fine.
Thanks for your help. |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Hi Arun,
There is a change in the requirement, I want to display Status field also.
It has to repeat the same values for Status field alone. Not for other fields.
Code: |
Status ............................... descr
---------------------------------------------
aa xxx
aa yyy
aa aaa
bb yyy
bb aaa
|
Other fields are some, no need to repeat it again.
Thanks
[/code] |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
I dont understand why people are not willing to state all of their requirements in their initial post itself. |
|
Back to top |
|
|
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Sorry arun,
I got to know only after seeing the result. Actually i need that field for further validation.
I tried with the below code and it is working fine
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(253:SEQNUM,8,ZD,RESTART=(01,82))),
IFTHEN=(WHEN=(253,8,ZD,NE,1),BUILD=(01:1,16,83:83,11,120:X)),
IFOUTLEN=120
|
Thanks |
|
Back to top |
|
|
giraffe
New User
Joined: 09 Nov 2010 Posts: 27 Location: SHENZHEN CHINA
|
|
|
|
I don't think these solutions above may work, since the value for restart fields should be in order, unfortunately there's a header... |
|
Back to top |
|
|
|