View previous topic :: View next topic
|
Author |
Message |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
Hi,
I have a field length of 18( in the file it's defined as comp3 field as expanded below) in the 80 bytes file...I am trying to omit the records as below.
Field position 2 to 3 : value is 91
Field position 5 to 6 : values are 83, 69 and 68
In comp3 it defined as 10 bytes field starting position is 42 till 51. As in attachment if 43 position is having '91' and (if second nibble of 44 and first nibble of position 45 having values as 83, 69 and 68).
I thought of achieving it in a 2 step sort.
1. Converting PD to zd and write in the position 81 to 98 by creating a new file 98 bytes file
2. Omit cond based on the above scenario and write using outrec up to 80 bytes
Do we able to achieve this in a simpler code? |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10896 Location: italy
|
|
|
|
DO NOT POST SCREENSHOTS
they clobber the browser window and make it unreadable
will please a moderator delete the screen shot
thank You |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1388 Location: Bamberg, Germany
|
|
|
|
Use the code button to provide sample data, AND preview anything before you post. |
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
Karthi89 wrote: |
Hi,
I have a field length of 18( in the file it's defined as comp3 field as expanded below) in the 80 bytes file...I am trying to omit the records as below.
Field position 2 to 3 : value is 91
Field position 5 to 6 : values are 83, 69 and 68
In comp3 it defined as 10 bytes field starting position is 42 till 51. As in attachment if 43 position is having '91' and (if second nibble of 44 and first nibble of position 45 having values as 83, 69 and 68).
I thought of achieving it in a 2 step sort.
1. Converting PD to zd and write in the position 81 to 98 by creating a new file 98 bytes file
2. Omit cond based on the above scenario and write using outrec up to 80 bytes
Do we able to achieve this in a simpler code? |
can we use bit notations in omit conditions. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1388 Location: Bamberg, Germany
|
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
I tried something as below and it isn't working as expected...No errors shown..
Inrec overlay=(81:42,10,pd,to=zd,length=18)
sort fields=copy
outrec ifthen=(when=82,2,zd,eq,91,and,(85,2,zd,eq,68,or,85,2,zd,eq,69)),build=(1,80)
Any suggestions pls? |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1388 Location: Bamberg, Germany
|
|
|
|
Show sample data as written before. Use the code button where appropriate. |
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
Code: |
the pd format as x'0[b]11[/b]8[b]68[/b]290938000000'
I need to exclude the record has 11 and 68 as in below
Packed format as below starts at position 42 till 51
0188998000
016203000F
|
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
Karthi89 wrote: |
I have a field length of 18 (in the file it's defined as comp3 field as expanded below) in the 80 bytes file... |
The maximum size of any COMP-3 field allowed by IBM architecture is 16 bytes.
When you convert it TO=ZD,LENGTH=18, it is not COMP-3 anymore!
RTFM. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
Karthi89 wrote: |
I tried something as below and it isn't working as expected...No errors shown..
Inrec overlay=(81:42,10,pd,to=zd,length=18)
sort fields=copy
outrec ifthen=(when=82,2,zd,eq,91,and,(85,2,zd,eq,68,or,85,2,zd,eq,69)),build=(1,80)
Any suggestions pls? |
As usually, any recommendation to RTFM eliminates any desire to do the job?
Code: |
//SYSIN DD *
INREC OVERLAY=(81:43,3,HEX) X'910680'->C'910680'
* || || || ||<-----------------85
* || || || |<------------------84
* || || ||<-----------------82
* || || |<------------------81
* || ||<---------------------45
* ||<-------------------------43
SORT FIELDS=COPY
OUTFIL OMIT=(81,2,CH,EQ,C'91',
AND,84,2,CH,EQ,L(C'68',C'69',C'83')),
BUILD=(1,80)
END
//* |
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
If, by a chance, there is someone who wants to learn something, here is another option, a bit more compact one:
Code: |
//SYSIN DD *
INREC OVERLAY=(81:43,3,HEX) X'910680'->C'910680'
* || || || ||<-----------------85
* || || || |<------------------84
* || || ||<-----------------82
* || || |<------------------81
* || ||<---------------------45
* ||<-------------------------43
SORT FIELDS=COPY
OUTFIL OMIT=(81,2,CH,EQ,C'91',
AND,84,2,SS,EQ,C'68,69,83'),
BUILD=(1,80)
END
//* |
|
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
Hi, Thanks for your reply. The above codes worked fine.
I missed to post a reply here. I tried as below and it worked fine.
Code: |
INREC OVERLAY=(81:42,10,PDTO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,OMIT=(82,2,ZD,EQ,91,AND,(85,2,ZD,EQ,68,OR
85,2,ZD,EQ,69,OR,85,2,ZD,EQ,83)),BUILD=(1,80)
|
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1388 Location: Bamberg, Germany
|
|
|
|
PDTO is not a valid keyword. You may have posted incomplete data. |
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
yes, it should be as below...Thanks for pointing out
Code: |
INREC OVERLAY=(81:42,10,PD,TO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,OMIT=(82,2,ZD,EQ,91,AND,(85,2,ZD,EQ,68,OR
85,2,ZD,EQ,69,OR,85,2,ZD,EQ,83)),BUILD=(1,80)
|
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
Karthi89 wrote: |
yes, it should be as below...Thanks for pointing out
Code: |
INREC OVERLAY=(81:42,10,PD,TO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,OMIT=(82,2,ZD,EQ,91,AND,(85,2,ZD,EQ,68,OR
85,2,ZD,EQ,69,OR,85,2,ZD,EQ,83)),BUILD=(1,80)
|
|
The major problem: if by a chance your 42,10 field is not fully correct packed decimal, you'll get ABEND S0C7 from SORT, without any detailed info...
From this point of view, my HEX approach is safer (and more simple).
Another way for fool-protection would be: add data verification
Code: |
...WHEN=(42,10,PD,EQ,NUM)... |
|
|
Back to top |
|
 |
Karthi89
New User
Joined: 06 Jan 2025 Posts: 7 Location: India
|
|
|
|
Thanks a lot for your response and detailed explanation.
I will go with hex option. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
Karthi89 wrote: |
yes, it should be as below...Thanks for pointing out
Code: |
INREC OVERLAY=(81:42,10,PD,TO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,OMIT=(82,2,ZD,EQ,91,AND,(85,2,ZD,EQ,68,OR
85,2,ZD,EQ,69,OR,85,2,ZD,EQ,83)),BUILD=(1,80)
|
|
It also would be nice to make any code, even the simplest one, as clear to understand as possible. I mention this point every time, but it doesn't help...
Code: |
INREC OVERLAY=(81:42,10,PD,TO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
OMIT=(82,2,ZD,EQ,91,
AND,(85,2,ZD,EQ,68,
OR,85,2,ZD,EQ,69,
OR,85,2,ZD,EQ,83)),
BUILD=(1,80) |
or even better
Code: |
INREC OVERLAY=(81:42,10,PD,TO=ZD,LENGTH=18)
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
OMIT=(82,2,ZD,EQ,91,
AND,85,2,ZD,EQ,L(68,69,83)),
BUILD=(1,80) |
|
|
Back to top |
|
 |
|
|