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
 

 

Omit Records with DFSORT
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Mon Apr 18, 2005 8:55 pm    Post subject: Omit Records with DFSORT
Reply with quote

Hi Guys, a new topic to discuss about.

I have a dataset ANDYCOOL.TEST.DATA

This dataset is an output for a job and contains some data like:
========ANDYCOOL.TEST.DATA========
cols: 123456789123456
270780078203042
165780078203043
153780078203044
241780078203045
===============================
Here, in the data given above, the First 3 chars and Last 6 chars are of significance to me.
Now, i want to write a pgm which shud do the following:

1. Take the input: first 3 chars and last 6 chars. (eg:- 165 203043)
2. Search the dataset ANDYCOOL.TEST.DATA for the record with this input (eg:- rec 2 from above data will be selected)
3. Omit all other records from the dataset except the one selected.
4. Final output shud be ANDYCOOL.TEST.DATA with only selected record
that is:
========ANDYCOOL.TEST.DATA========
cols: 123456789123456
165780078203043
===============================

Please let me know how shud i structure the program as well as the
JCL

Thanks in advance,
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 Apr 18, 2005 9:19 pm    Post subject:
Reply with quote

Do you really want to write a program? If not, then you could use the following DFSORT job to do this:


Code:

//S1  EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(1,3,CH,EQ,C'165',AND,10,6,CH,EQ,C'203043')
/*
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Mon Apr 18, 2005 9:38 pm    Post subject:
Reply with quote

I want this to make up a Utility that can be used by other programers.

Only thing they shud do is give the input data in some dataset and leave all to the pgm.
Your JCL idea is very nice, but from point of view of a user, playin with the JCLs wont be a gr8 idea.

pgm shud be like:
1. Take the data to be searched from 1 dataset.
2. Search this in ANDYCOOL.TEST.DATA
3. If data found omit others and keep only the selected record.

In this case there'll be two input DDs and one output DDs.

See if you are getting my point.
However, Very much thanks for your input and showing your interest. It is very helpful.
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 Apr 19, 2005 1:22 am    Post subject:
Reply with quote

DFSORT is a utility that can be used by other programmers.

There are several ways to do what you want, depending on what the data to be searched in the separate input data set can look like. For example, you could make the data to be searched DFSORT symbols like in this job:

Code:

//S1  EXEC  PGM=ICEMAN
//SYMNAMES DD *
Targ1,'165'
Targ2,'203043'
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(1,3,CH,EQ,Targ1,AND,10,6,CH,EQ,Targ2)
/*


You can use any symbol names you like instead of Targ1 and Targ2.

Or if you want the data to be searched in the separate data set to look like this:

//SEARCH DD *
165 203043
/*

that could be done with DFSORT as well.

But if you feel that you need to reinvent the wheel by writing your own program, that's your call.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Tue Apr 19, 2005 7:19 pm    Post subject:
Reply with quote

Thanks Frank,
This solution is quite feasible. This shud solve my purpose.

Juss one more doubt:
You asked to use the DFSORT..but in the above code that you have presented..u have used ICEMAN. What exactly is this ICEMAN utility..has it anything to do with the DFSORT?
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 Apr 19, 2005 8:25 pm    Post subject:
Reply with quote

ICE is the IBM three-character id for DFSORT, so DFSORT's modules, messages, etc use ICE. ICEMAN is DFSORT's entry point. However, the other sort products have chosen to make ICEMAN and SORT entry points for their products as well. So when you use PGM=ICEMAN or PGM=SORT, you invoke the primary sort product installed at your site. That could be DFSORT, or it could be one of the other products.

Dude ... Could you please do everyone a favor and use regular English instead of abbreviations, e.g. use "should" instead of "shud", "don't worry" instead of "Dun wry", "you" instead of "u", etc. The abbreviations are sometimes hard to understand, especially for us "older" dudes. Thanks.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Wed Apr 20, 2005 9:41 pm    Post subject:
Reply with quote

No problem boss.
I ll take care hens4th ;)

Thanks for your input Guys...it was very helpful..!
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Sun Apr 24, 2005 11:05 am    Post subject:
Reply with quote

Hey Frank,
The solution that you have given above about using the TARG1 and TARG2 can just be limited to one search at a time.
Suppose if i want to search and maintain 2 or more of such records like:
========ANDYCOOL.TEST.DATA========
cols: 123456789123456
165780078203043
241780078203045
===============================
what will i have to do? Can i use it like this:

//S1 EXEC PGM=ICEMAN
//SYMNAMES DD *
Targ1,'165'
Targ2,'203043'
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,3,CH,EQ,Hse1,AND,10,6,CH,EQ,Ord1)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,3,CH,EQ,Hse2,AND,10,6,CH,EQ,Ord2)
/*

Please correct me if i am wrong.

Bottomline: The search and omit shud not be limited to juss one record at a time.
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 Apr 25, 2005 4:10 am    Post subject:
Reply with quote

You can have many symbols in SYMNAMES. You can have many relational conditions in an INCLUDE statement. If you want to search for the records containing the values Hse1 and Ord1, or Hse2 and Ord2, you can do it like this:

Code:

//S1  EXEC  PGM=ICEMAN
//SYMNAMES DD *
Hse1,'165'
Ord1,'203043'
Hse2,'241'
Ord2,'203045'
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INCLUDE FORMAT=CH,
     COND=((1,3,EQ,Hse1,AND,10,6,EQ,Ord1),OR,
         1,3,EQ,Hse2,AND,10,6,EQ,Ord2))
/*


If that's not what you want to do, then please explain more clearly what you want to do.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Tue Apr 26, 2005 5:40 pm    Post subject:
Reply with quote

Thanks Frank,
This is what i wanted.

Please tell me wht i am interpreting is right or wrong

In the condition :
1,3,EQ,Hse1,AND,10,6,EQ,Ord1 ..does it mean

From first upto third character equal to Hse1 AND From tenth upto sixteenth character equal to Ord1.

If this is right my doubt is, where does the Omit condition comes into picture. Is it that By default "SORT" removes all the records except the one matched with the above condition?

Thanks in advance,
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 Apr 26, 2005 9:46 pm    Post subject:
Reply with quote

Yes, 1,3 means positions 1-3. 1 is the starting position and 3 is the length.

10,6 means positions 10-15. 10 is the starting position and 6 is the length.

INCLUDE keeps all of the records that match the given condition and deletes all of the records that do not match the given condition.

OMIT deletes all of the records that match the given condition and keeps all of the records that do not match the given condition.

If you're not familiar with DFSORT and ICETOOL, I'd suggest going through "z/OS DFSORT Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access Getting Started, and all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Tue Apr 26, 2005 10:24 pm    Post subject:
Reply with quote

Thanks Man,
This has been really helpful.
I thank all you guys for your inputs.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Tue Apr 26, 2005 10:43 pm    Post subject:
Reply with quote

Hi again,
Continuing with my doubts, juss have some more of 'em(Please dun pull ur hair):

I have a dataset ANDYCOOL.TEST.DATA
It contains some wierd data wch actually i dun understand.
My only concern is, i need to find a 6 character string in that dataset.

For instance:
=========ANDYCOOL.TEST.DATA===========
asasasasasasassasasasaaaasasasaaaasaaasasaasasa
asasasasasasassasasasaaaasasasaaaasaaasasaasasa
asasasasasasassasasas123456sasaaaasaaasasaasasa
asasasasasasassasasasaaaasasasaaaasaaasasaasasa
asasasasasasassasasasaaaasasasaaaasaaasasaasasa
===================================

Yaa..its something like given above. Now, how do i find the string "123456" in the above dataset. Mind you, there is no fixed cloumn or row whr the string will appear everytime.
From the above posts i understand i'll have to use the ICEMAN tool, but how do i modify it to meet the requirement.

Regards and Thanks in Advance,
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 Apr 26, 2005 11:40 pm    Post subject:
Reply with quote

Quote:
I thank all you guys for your inputs.


All what guys? So far, it's just you and me here, buddy. icon_lol.gif

You can use DFSORT's SS (substring search) format in INCLUDE to output the record that contains the string as follows:

Code:

   INCLUDE COND=(1,n,SS,EQ,C'123456')


where n is the length of the record (e.g. 80).

Is that what you want to do?
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Wed Apr 27, 2005 4:04 pm    Post subject:
Reply with quote

Yes Buddy,
This is what is wanted. I'll try it out. If it worked fine, thanks to you,
...if not, you are in trouble, cuz am goin to ask you lots and lots of doubts ;)

I am verymuch thankful to you Frank for handholding me till here, :)

Regards,
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 Apr 27, 2005 8:32 pm    Post subject:
Reply with quote

Glad I could help.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Wed Apr 27, 2005 10:37 pm    Post subject:
Reply with quote

Hi Frank,
I used the below code to search the string and to delete the remaining records in a dataset:
==========================
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,3,CH,EQ,C'165',AND,10,6,CH,EQ,C'203043')
/*
==========================

The problem i faced with this is, it was working fine when the Input and the output datsets were "FB" ie fixed block.
When i tried to do this by datasets with "VB" ie variable block, the job executed successfully, but the output was coming empty, even though the record existed with that condition.

The Input and Output dataset are goin to be "VB" as per my requirement.
Is it that the ICEMAN or SORT utilities dun wrk with the VB datasets? or
I am missing something above?

Please let me know.
Thanks in Advance.
Regards,
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: Thu Apr 28, 2005 12:10 am    Post subject:
Reply with quote

Yes, DFSORT can work with VB data sets, but you have to use the correct starting positions. VB records have an RDW in positions 1-4, so the data starts in position 5, not in position 1 as for FB records. Thus, you have to add 4 to your starting positions in the INCLUDE statement to account for the RDW.

Code:

  INCLUDE COND=(5,3,CH,EQ,C'165',AND,14,6,CH,EQ,C'203043')
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Thu Apr 28, 2005 2:50 pm    Post subject:
Reply with quote

Hi Frank,
Your solution as usual worked properly. I was able to get the required data in the output datatset. Thanks for this.

If you remeber somewhere in this thread i had asked you about just searching a string in the datafile. You had suggested me of using the SS substring: INCLUDE COND=(5,3,SS,EQ,C'290'). I used the below code:
=========
/*
//SEARCH EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=.........INPUT,DISP=SHR
//SORTOUT DD DSN=.......OUTPUT,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSALLDA,
// SPACE=(TRK,(150,5),RLSE),
// DCB=(LRECL=2015,BLKSIZE=23476,RECFM=VB)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(5,3,SS,EQ,C'290')
/*
==============================
Using this i got the selected record in the output dataset just like i got it after using the "INCLUDE COND=(12,3,CH,EQ,C'290'). I dont want it that way.

What i want it is:
1. Search for the string in the Variable Block dataset.
2. If found execute the next step in job.
3. If not found terminate the job.

Please tell me how can i do this.
Thanks in Advance.
Regards,
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: Thu Apr 28, 2005 9:27 pm    Post subject:
Reply with quote

Quote:
INCLUDE COND=(5,3,SS,EQ,C'290')


Yes, in this case SS is equivalent to CH because your field and constant are the same length (3). Here's an example of using SS where it isn't equivalent to CH:

Code:

  INCLUDE COND=(5,25,SS,EQ,C'290')


In this case, we will search for '290' anywhere between positions 5 and 29.

Quote:
What i want it is:
1. Search for the string in the Variable Block dataset.
2. If found execute the next step in job.
3. If not found terminate the job.



I need answers to the following questions before I can tell you how to do this:

1) Are you using z/OS DFSORT V1R5 or DFSORT R14? The ICE000I message from a DFSORT run will tell you which one you're using. Let me know. If you can't tell, post the //SYSOUT messages from a PGM=SORT run.
2) What is the LRECL of your input file?
3) I can show you how to set a return code of zero or non-zero depending on whether the string was found or not. You could use the return code to control subsequent steps. Is that what you mean by 2 and 3?
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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 How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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