View previous topic :: View next topic
|
Author |
Message |
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
I am trying to copy records having a field in S9(12) format.
Code: |
FIELD NAME ---------- - PICTURE- - START END LENGTH
FIELDA S9(12) 5197 5203 7
|
I am using condition as
Code: |
SORT FIELDS=COPY
INCLUDE COND=(5100,100,SS,EQ,X'369395124501')
|
But its not picking the record. Not sure what mistake I am doing. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
well...
what does Your record look like when You browse it and display it in hex format ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't have a field in an S9(12) format. What you have quoted only shows you the number of decimal digits the field will be allowed to hold (nb, depends on compiler option for a binary field).
So, you have a signed numeric field. It is either Zoned Decimal, Packed Decimal or Binary. A Zoned Decimal would be 12 bytes, a binary would be a double-word (eight bytes) and your display shows a length of seven. The length of S9(12) comp-3 (packed-decimal) would be seven bytes.
X'0369395124501C'
That is what a value of 369395124501 would look like if positive in a packed-decimal field. If negative the C would be a D. If your data may not conform to picture, then A through F would be valid for the final character in the hex string above?
Why don't you know the position? Are you searching for a value in an OCCURS? |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Record look like this.
Code: |
7/PS
(5197-5203)
375----------
*************
&
0635251
399140C
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
So that's why you couldn't find it. SS can't do "half-bytes" which is effectively what you tried (two of them).
Try with the string I suggested above. |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
I tried
Code: |
INCLUDE COND=(5197,7,PD,EQ,X'0369395124501C')
|
But still its nt getting copied |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if the record is variable remember to take into account the 4 bytes RDW |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Plus, if you're going to look in a specific position, for a PD, why don't you just put +369395124501? No need to do it as X'...' |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Still not working.
And input file format is FB. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Still not working. |
Probably you have specified the wrong displacement/length or have specified a non-matching value. Only you can verify that your specifications are correct.
Suggest you post the complete JCL and sort control info as well as the informational messages (including the message ids) generated by the run. |
|
Back to top |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
Code: |
INCLUDE COND=(5197,7,PD,EQ,369395124501) |
Try it. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
//INCPD EXEC PGM=SORT
//SORTIN DD *
369395124501
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTOFF1 DD SYSOUT=*
//SORTOFF2 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(15:1,12,ZD,TO=PD,LENGTH=7,
25:15,7,PD,TO=ZD,LENGTH=12)
OUTFIL INCLUDE=(15,7,PD,EQ,+369395124501)
OUTFIL FILES=F1,INCLUDE=(15,7,PD,EQ,369395124501)
OUTFIL FILES=F2,INCLUDE=(15,7,CH,EQ,X'0369395124501C') |
All three OUTFILs give the following:
Code: |
369395124501 & 369395124501 |
When I use your PD with comparison to X'...' it gives a syntax error. That would explain why that one isn't working, it's an
Code: |
ICE114A E INVALID COMPARISON |
If you didn't notice that one, have you got other errors in your sort deck which are preventing the correct results appearing in the output? |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Thanks a lot. Condition works. I haves used below condition finaly.
Code: |
OPTION COPY
OUTFIL INCLUDE=(5197,7,PD,EQ,+369395124501)
|
I am using two files in SORTIN, is there a way to find out from which file this record gets selected and on finding that copy first and last record present in that file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You've not mentioned that bit before.
You cannot tell directly from which of concatenated files a particular record came from.
If you can set out this new requirement clearly, someone may be able to help.
What if the data appears on both files? Neither file? Is duplicate on a file?
Is there anything on the records to distinguish which file it comes from?
Is there any "count" of the records on a trailer for the files, for instance?
What are the "first" and "last" record that you want? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
it would be nice, and would save everybody a lot of time,
if the requirements were all described in the initial question ! |
|
Back to top |
|
|
|