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
 

 

How to use IFTHEN and FIELDS in same the INREC

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

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Tue Oct 31, 2006 6:34 pm    Post subject: How to use IFTHEN and FIELDS in same the INREC
Reply with quote

Hi,

When using inrec in sort, i want to use IFTHEN and INREC fields at the same time.

For example,

If my input file(FB, LRECL=9) is:
UTHHJKADF
GTHMNGAVF
KGHGAJYUN

In the output file it should be as:
1st byte should be:
'1' IF 1,1,CH,EQ,C'U'
'2' IF 2,1,CH,EQ,C'T'
'3' IF 3,1,CH,EQ,C'H'

and the record as in input file will be placed in output file from position 2.
i.e. the output should be
1UTHHJKADF
2GTHMNGAVF
3KGHGAJYUN

The actual conditions i use are so huge, i planned to use
INREC IFTHEN to overlay the TEXT at the 1st position.

Now, HOW can i use INREC to place the input file record from position 2.

Your timely help will be highly appreciated.

Regards,
OP
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: Tue Oct 31, 2006 9:25 pm    Post subject:
Reply with quote

For each IFTHEN clause, you must use BUILD or OVERLAY to specify the action to be taken when the WHEN condition is satisfied. In your case, you would use BUILD in each IFTHEN clause. 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 (FB/9)
//SORTOUT DD DSN=...  output file (FB/10)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'U'),BUILD=(C'1',1,9)),
        IFTHEN=(WHEN=(2,1,CH,EQ,C'T'),BUILD=(C'2',1,9)),
        IFTHEN=(WHEN=(3,1,CH,EQ,C'H'),BUILD=(C'3',1,9))
/*
Back to top
View user's profile Send private message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Wed Nov 01, 2006 3:16 pm    Post subject:
Reply with quote

Hi Yaeger,

Thanks a lot for the reply.

I want to write all the records that are not selected by any IFTHEN condition to other file. How do i do it?

Please help.

Regards,
OP
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: Wed Nov 01, 2006 9:43 pm    Post subject:
Reply with quote

Quote:
I want to write all the records that are not selected by any IFTHEN condition to other file.


Here's a DFSORT job that will do it:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/9)
//OUT1 DD DSN=...  output file1 (FB/10)
//OUT2 DD DSN=...  output file2 (FB/9)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=11,
        IFTHEN=(WHEN=(1,1,CH,EQ,C'U'),BUILD=(C'1',1,9)),
        IFTHEN=(WHEN=(2,1,CH,EQ,C'T'),BUILD=(C'2',1,9)),
        IFTHEN=(WHEN=(3,1,CH,EQ,C'H'),BUILD=(C'3',1,9)),
        IFTHEN=(WHEN=NONE,BUILD=(1,9,11:C'N'))
  OUTFIL FNAMES=OUT1,INCLUDE=(11,1,CH,NE,C'N'),
    BUILD=(1,10)
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,9)
/*
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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Need Help to Define 36 Input Fields (... satish.ms10 CLIST & REXX 2 Sat May 07, 2016 3:08 pm
No new posts What does this INREC do? Lino Pontes DFSORT/ICETOOL 5 Fri Apr 08, 2016 12:17 am
No new posts FileAid to compare(logical operations... anand1204 Compuware & Other Tools 3 Wed Apr 06, 2016 2:55 am


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