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

Selective Selection in DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Mon May 28, 2007 2:13 pm
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
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 Developer


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

PostPosted: Mon May 28, 2007 9:32 pm
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
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
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 Developer


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

PostPosted: Tue May 29, 2007 8:34 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top