|
View previous topic :: View next topic
|
| Author |
Message |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
Hi Friends,
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 |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 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. |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
Hi Joe,
I tried this, considering LRECL is 620 and RCFM =VB
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(44,1,CH,EQ,C'K'),
END=(44,1,CH,EQ,C'X'),
PUSH=(625:ID=5,SEQ=3))
outfil fnames=out1,OMIT=((44,1,CH,EQ,C'T')
am not clear, where should we check for (59,5=GTRFU) on the S-rec |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 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 |
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Also here, feedback welcome. My Name however is NOT Joe. |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
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. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Please share your solution as others might also benefit from it. |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
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.
SORT FIELDS=(5,74,A),FORMAT=BI
INREC IFTHEN=(WHEN=GROUP,BEGIN=(60,5,CH,EQ,C'GTRFU'),
END=(44,1,CH,EQ,C'X',OR,44,1,CH,EQ,C'L'),
PUSH=(625:60,1))
OUTFIL OMIT=(44,1,CH,EQ,C'T',AND,625,1,CH,NE,C' ')
OUTREC BUILD=(5,620) |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Use the code button above and do not use screen shots. It's hard to follow up this way. |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
I tried the below code, could not fix the issue..
SORT FIELDS=(5,74,A),FORMAT=BI
INREC IFTHEN=(WHEN=GROUP,BEGIN=(60,5,CH,EQ,C'GTRFU'),
END=(44,1,CH,EQ,C'X',OR,44,1,CH,EQ,C'L'),
PUSH=(625:60,1))
OUTFIL OMIT=(44,1,CH,EQ,C'T',AND,625,1,CH,NE,C' '),
BUILD=(1:1,4,5:5,620) |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| Maheshreddy25 wrote: |
| I tried the below code, could not fix the issue.. |
If you continue posting such senseless messages, you'll never get any help.
In case you really need help, please submit all detailed information here.
First of all, finally learn how to use the Code button:
| Maheshreddy25 wrote: |
| Code: |
SORT FIELDS=(5,74,A),FORMAT=BI
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(60,5,CH,EQ,C'GTRFU'),
END=(44,1,CH,EQ,C'X',OR,44,1,CH,EQ,C'L'),
PUSH=(625:60,1))
OUTFIL OMIT=(44,1,CH,EQ,C'T',AND,625,1,CH,NE,C' '),
BUILD=(1:1,4,5:5,620) |
|
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  |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
@Maheshreddy25: Please send the requested Info and also RECFM, LRECL for the Dataset.  |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
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. |
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 421 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
click on Code button
type your text
click on Code button
type your text
select the text
click on Code button |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
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.
| Code: |
1----5----10----15----20----25----30----35----40----45----50----55----60----65----70----75----80----85----90----95----100
12345678911***********************************K**************************************************************************
12345678911***********************************S*******************GTRFU**************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************X**************************************************************************
12345678911***********************************S*******************CTRFU**************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************X************************************************************************** |
My Output file should look like below.
| Code: |
1----5----10----15----20----25----30----35----40----45----50----55----60----65----70----75----80----85----90----95----100
12345678911***********************************K**************************************************************************
12345678911***********************************S*******************GTRFU**************************************************
12345678911***********************************X**************************************************************************
12345678911***********************************S*******************CTRFU**************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************T**************************************************************************
12345678911***********************************X************************************************************************** |
I have used the below SORT card to get the expected results,
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,4,5:1X,6:5,620)),
IFTHEN=(WHEN=GROUP,BEGIN=(61,5,CH,EQ,C'GTRFU'),
END=(45,1,CH,EQ,C'X'),PUSH=(5:61,1)
OUTFIL OMIT=(45,1,CH,EQ,C'T',AND,5,1,CH,NE,C' ')
OUTREC BUILD=(1:1,4,5:6,620)
SORT FIELDS=COPY
/*
|
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. |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
| Friends, any help to fix the above issue, would be really helpful. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| Maheshreddy25 wrote: |
| 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 |
|
| Back to top |
|
 |
Maheshreddy25
New User
Joined: 24 Sep 2022 Posts: 9 Location: India
|
|
|
|
Hi,
Thanks for your reply, I have updated my SORT CARD as per your advice,
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,4,5:1X,6:5,620)),
IFTHEN=(WHEN=GROUP,BEGIN=(61,5,CH,EQ,C'GTRFU'),
END=(45,1,CH,EQ,C'X'),PUSH=(5:61,1)
OUTFIL OMIT=(45,1,CH,EQ,C'T',AND,5,1,CH,NE,C' ')
OUTfIL BUILD=(1:1,4,5:6,620)
SORT FIELDS=COPY
/* |
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) |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| Maheshreddy25 wrote: |
Hi,
Thanks for your reply, I have updated my SORT CARD as per your advice,
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,4,5:1X,6:5,620)),
IFTHEN=(WHEN=GROUP,BEGIN=(61,5,CH,EQ,C'GTRFU'),
END=(45,1,CH,EQ,C'X'),PUSH=(5:61,1)
OUTFIL OMIT=(45,1,CH,EQ,C'T',AND,5,1,CH,NE,C' ')
OUTfIL BUILD=(1:1,4,5:6,620)
SORT FIELDS=COPY
/* |
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. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|