IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copying records using INCLUDE


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Mon Apr 16, 2012 2:49 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Apr 16, 2012 2:58 pm
Reply with quote

well...
what does Your record look like when You browse it and display it in hex format ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 3:06 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Mon Apr 16, 2012 3:08 pm
Reply with quote

Record look like this.


Code:


7/PS         
(5197-5203) 
375----------
*************
     &       
0635251     
399140C     

Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 3:11 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Mon Apr 16, 2012 3:27 pm
Reply with quote

I tried


Code:

INCLUDE COND=(5197,7,PD,EQ,X'0369395124501C')



But still its nt getting copied
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Apr 16, 2012 3:32 pm
Reply with quote

if the record is variable remember to take into account the 4 bytes RDW
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 3:37 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Mon Apr 16, 2012 9:48 pm
Reply with quote

Still not working.
And input file format is FB.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 10:24 pm
Reply with quote

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
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Mon Apr 16, 2012 10:25 pm
Reply with quote

Code:
INCLUDE COND=(5197,7,PD,EQ,369395124501)


Try it.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 11:49 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Tue Apr 17, 2012 8:51 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 17, 2012 11:58 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Apr 17, 2012 12:44 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top