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

Extract comp3 fields in multiple positions


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sun Mar 19, 2006 8:51 pm
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
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 Developer


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

PostPosted: Mon Mar 20, 2006 10:08 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top