This is my first post on the forum, please help me. Below is my scenario, Pl see the attachment on my input file looks like.
1-11 is account NUMBER
40th position, we have Rec-type( example K,S,T,L,X)
My requirement is on the S record type (if 55:5 = GTRFU) the
Skip all the below T-records and K-rec L-rec and X-rec should come
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
Do not use attachments, but the code button above when presenting code or data. What have you tried so far?
Basically you need to use an IFTHEN WHEN=(GROUP,BEGIN condition and PUSH a character at the end of the record. In OUTFIL you OMIT/INCLUDE for non-blank characters and that's it.
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
Input:
Code:
XXXXXXXXXXX K
XXXXXXXXXXX S GTRFU
XXXXXXXXXXX T
XXXXXXXXXXX T
XXXXXXXXXXX L
XXXXXXXXXXX X
YYYYYYYYYYY K
YYYYYYYYYYY S GTRFU
YYYYYYYYYYY T
YYYYYYYYYYY T
YYYYYYYYYYY T
YYYYYYYYYYY T
YYYYYYYYYYY L
YYYYYYYYYYY X
ZZZZZZZZZZZ K
ZZZZZZZZZZZ S STFUS
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ L
ZZZZZZZZZZZ X
Code:
Code:
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(55,5,CH,EQ,C'GTRFU'),END=(40,1,CH,EQ,C'X'),PUSH=(60:55,1))
OUTFIL OMIT=(40,1,CH,EQ,C'T',AND,60,1,CH,NE,C' '),BUILD=(1,59)
END
Output:
Code:
XXXXXXXXXXX K
XXXXXXXXXXX S GTRFU
XXXXXXXXXXX L
XXXXXXXXXXX X
YYYYYYYYYYY K
YYYYYYYYYYY S GTRFU
YYYYYYYYYYY L
YYYYYYYYYYY X
ZZZZZZZZZZZ K
ZZZZZZZZZZZ S STFUS
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ T
ZZZZZZZZZZZ L
ZZZZZZZZZZZ X
Hi,
Apologies for the delayed reply, It is working fine now, I had to update the sort card a little bit, to update the trailer record with the number of records. Thanks a TON, for your help.
Hi,
Am facing another issue on the above requirement,
My file is of 620 Record-length and VB format, My SORT CARD is as below, with PUSH command am using one extra byte at 621 position, but finally my out should be 620 record-length as it is used as input file in downstream. With the OUTREC am trying to copy only till 620 bytes instead of extra byte we added with PUSH.
Am seeing ICE251A 0 MISSING RDW OR DATA FOR *OUTREC.
Not clear on how to fix this.
My SORT card looks like below.
Next, copy here everything of:
1) your input data (using Code button!)
2) your own used code (using Code button!)
3) your desired output data (using Code button!)
4) your actual output data (using Code button!)
5) all and every error message, and/or error code you get (using Code button!)
Otherwise you may continue posting your senseless messages forever, if you prefer doing so.
P.S.
99% of the forum members do not open the message attachments, at all.
Only Joerg.Findeisen is a rare exception
Hi,
I really tried to use the code button, but i was not clear on that,
secondly, i work on VDI, so cannot copy /paste the code here. Thats the reason, i gave the SORT CARD as plain text. The Record length is 620 and RCFM is VB.
Thanks for all your help.
Here is my requirement,
My record length is 620, and VARIABLE FORMAT file.
pos 1-11 is the customer-num, on the 40th position is record-type, (K-rec,S-rec,T-rec,X-rec) K-rec is the unique record. (4 bytes will add to the position as it is a Variable format)
My requirement is,On the S-rec, position 56:5=GTRFU, Then I need exclude all T-rec under that PARTICULAR S-record. Myinput file looks like below. Because of space constraint, I am copying only first 100 bytes instead of full record length of 620 bytes.
With the INREC, I am rebuilding the record, with 1,4 for RDW, adding one space on 5th position and copying the entire record from 6th position, now the length of the record will be 625(621+4 , as it is VB format) instead of 624(620+4 as it is VB format), as we are adding one extra padding chracter with PUSH
Then grouping the records and padding with one letter 'G' at position 5 from 61 position, using PUSH
Then am omiting the T-records if the record has T on 45th pos and not equal to space on 5 pos (This is a variable format file)
Then using outrec, am rebuilding the record removing the extra padding chracter at 1st position.
With the above SORT CARD, am not able to group the records and all T-records are excluded. Please help me in fixing this issue.
Thank you for letting me know on how to use the code button.
Friends, any help to fix the above issue, would be really helpful.
The OUTREC statement is executed not in the order it appears in your code, but always before OUTFIL statement!
So, you are spoiling all positions of your fields used later in your OMIT=.
Just move your BUILD= from OUTREC to OUTFIL.
It is often useful to RTFM…
P.S.
I always suggest to code the SORT statements in the order they are executed by the utility. But all my appeals do sink down a hole
JOINKEYS
JOIN
REFORMAT
INCLUDE/OMIT
INREC
SORT
OUTREC
OUTFIL
END
But the issue is not fixed, but all the T-records are excluded and Record-length is still 621 and padding character is still available at starting of the record, even after using
But the issue is not fixed, but all the T-records are excluded and Record-length is still 621 and padding character is still available at starting of the record, even after using
Code:
OUTfIL BUILD=(1:1,4,5:6,620)
Two different OUTFIL create TWO DIFFERENT(!) output datasets!!!
Either read all SORT messages yourself, or copy the whole log into your posting. We cannot guess what is happening at your site!!!
RTFM, please....
P.S.
SORT is executed before OUTFIL. RTFM, please.
P.P.S.
It is really boring, to repeat the same trivial suggestions 10 to 100 times to everyone of 100-200 new visitors, who are lazy to RTFM, and/or to search the forum for exactly the same issues.