Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Spool Extract for Z /os 1.04 version Khadhar Basha CLIST & REXX 3 Thu Sep 28, 2017 3:14 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us