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
 

 

Selective Selection in DFSORT

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

New User


Joined: 30 Nov 2006
Posts: 78
Location: SINGAPORE

PostPosted: Mon May 28, 2007 1:42 pm    Post subject: Selective Selection in DFSORT
Reply with quote

Hi,
I have a requirement that from a dataset (FBA, 133)
I have to find the occurence (would be there in dataset once only) of
Code:

1_|            332 |

i.e. starting string "1_|" and ending string "|", the string in between needs to be converted to a number. In this case it would be 332 and should become the returncode of my job.
So in this case the job should return 332
or return a non-zero(ex 4) return code if the number is > 0
else return 0
so this job should return 4.
Thanks in advance
Nimesh
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon May 28, 2007 2:13 pm    Post subject:
Reply with quote

Why dont you write a program for this? I dont think its possible with DFSORT.
Back to top
View user's profile Send private message
Nimesh.Srivastava

New User


Joined: 30 Nov 2006
Posts: 78
Location: SINGAPORE

PostPosted: Mon May 28, 2007 2:17 pm    Post subject:
Reply with quote

Yes, I agree that writing a program is much simpler but introducing a new job with all dependencies in a production is tougher than introducing a new JCL. Hence the reason, I thought with DFSORT there could be a way.
Thanks
Nimesh
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 May 28, 2007 9:32 pm    Post subject:
Reply with quote

Here's a z/OS DFSORT V1R5 job that will pass back RC=4 if the numeric value in the target record is greater than 0 (e.g. 332) or pass back RC=0 if the numeric value is <= 0 (e.g. 0 or -1). I assumed the target input record would always be present, that the numeric value would have a maximum of 10 characters, and that you didn't want any output records.

z/OS DFSORT V1R5 is required to use NULLOFL. If you have DFSORT R14, you can do the same kind of thing using ICETOOL's COUNT instead of NULLOFL.

You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's PARSE function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free).

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FBA/133)
//SORTOUT  DD DUMMY
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,3,CH,EQ,C'1_|',AND,4,129,SS,EQ,C'|')
  INREC PARSE=(%=(STARTAFT=C'1_|'),
    %01=(STARTAT=NONBLANK,ENDBEFR=C'|',FIXLEN=10)),
    BUILD=(X,%01,SFF,TO=ZD,LENGTH=10)
  OUTFIL NULLOFL=RC4,INCLUDE=(2,10,ZD,LE,+0)
/*
Back to top
View user's profile Send private message
Nimesh.Srivastava

New User


Joined: 30 Nov 2006
Posts: 78
Location: SINGAPORE

PostPosted: Tue May 29, 2007 11:38 am    Post subject:
Reply with quote

Hi Frank,
Thanks a lot for the solution, actually what I forgot to mention that the character "1_|" would not be the starting character in the line.
And yes you were right I actually used COUNT for achieving this icon_biggrin.gif
here's what I did
Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD  DUMMY
//TOOLMSG  DD SYSOUT=*
//SORTIN DD DSN=*.CHECK.SYSPRINT,DISP=SHR
//SORTOUT DD DSN=...outpout
//SYSIN    DD    *
  OPTION COPY
  OUTREC FIELDS=(1,133,SQZ=(SHIFT=LEFT))
and next step
COUNT FROM(IN) EMPTY RC4
/*

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

New User


Joined: 30 Nov 2006
Posts: 78
Location: SINGAPORE

PostPosted: Tue May 29, 2007 11:41 am    Post subject:
Reply with quote

sorry missed the step in middle
Code:

//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,4,CH,EQ,C'1_|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: Tue May 29, 2007 8:34 pm    Post subject:
Reply with quote

Quote:
the character "1_|" would not be the starting character in the line.


My PARSE solution will work for that situation just fine. STARTAFT=C'1_|' will find '1_|' anywhere in the record. You don't need to shift the characters.
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 DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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