Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract comp3 fields in multiple positions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Sun Mar 19, 2006 11:01 am    Post subject: Extract comp3 fields in multiple positions
Reply with quote

Hi,
I have a input file (record format is FB and record lenght is 756)

I have three Comp-3 fields coming in positions say 100, 120 and 140.I want to extract 11 characters .

So I have this in my JCL

OUTREC FIELDS=(1:120,6,PD,EDIT=(TTTTTTTTTTT))

I want to know how to extract comp 3 fields in position 120 and 140 .
Note: Comp3 field will definitely come in position 100..But may or may not come in positions 120 and 140. Need do check if positions 120 and 140 have values..If they do come in positions 120 and 140 I need to have them in the output.

Finally I want my output file(which is also FB) to have:


12345678904
53453453555
67568843244

(each of the Comp3 field should appear in a separate line)


Thanks
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Mar 19, 2006 8:51 pm    Post subject:
Reply with quote

To get the three values in three records, you can use a DFSORT OUTFIL statement like this:

Code:

    OUTFIL OUTREC=(100,6,PD,EDIT=(TTTTTTTTTTT),/,
          120,6,PD,EDIT=(TTTTTTTTTTT),/,
          140,6,PD,EDIT=(TTTTTTTTTTT))


But you also said
Quote:
Comp3 field will definitely come in position 100..But may or may not come in positions 120 and 140. Need do check if positions 120 and 140 have values..If they do come in positions 120 and 140 I need to have them in the output.


You need to explain what you mean by that. What does it mean for the field starting in position 120 or 140 to not have a value? Do you mean the field has a P'0' (PD value of 0), or binary zeros or blanks or what? It would really help if you would show the value you want to check for in hex.
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Mon Mar 20, 2006 8:53 pm    Post subject: Re: Extract comp3 fields in multiple positions
Reply with quote

Thanks for the reply Frank.
Yes, the field has the PD value of 0.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Mar 20, 2006 10:08 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
* Edit PD values to ZD values in 1, 21 and 41.
  INREC BUILD=(1:100,6,PD,EDIT=(TTTTTTTTTTT),
          21:120,6,PD,EDIT=(TTTTTTTTTTT),
          41:140,6,PD,EDIT=(TTTTTTTTTTT))
* If value in 21 not 0 and value in 41 not 0,
* write out 1, 21 and 41 values.
  OUTFIL IFTHEN=(WHEN=(21,11,ZD,NE,0,AND,41,11,ZD,NE,0),
           BUILD=(1,11,/,21,11,/,41,11)),
* If value in 21 not 0 and value in 41 is 0,
* write out 1 and 21 values.
         IFTHEN=(WHEN=(21,11,ZD,NE,0,AND,41,11,ZD,EQ,0),
           BUILD=(1,11,/,21,11)),
* If value in 21 is 0 and value in 41 not 0,
* write out 1 and 41 values.
         IFTHEN=(WHEN=(21,11,ZD,EQ,0,AND,41,11,ZD,NE,0),
           BUILD=(1,11,/,41,11)),
* If value in 21 is 0 and value in 41 is 0,
* write out 1 value.
         IFTHEN=(WHEN=(21,11,ZD,EQ,0,AND,41,11,ZD,EQ,0),
           BUILD=(1,11))
/*
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Mar 21, 2006 2:37 am    Post subject: Re: Extract comp3 fields in multiple positions
Reply with quote

Thank you Frank
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to catalog a gdg dataset resid... Shovan JCL & VSAM 4 Fri Mar 24, 2017 2:24 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us