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
 

 

Re-running the SORT for different SYMNAMES

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 3:40 pm    Post subject: Re-running the SORT for different SYMNAMES
Reply with quote

Hi,

Could you please help me if its possible to run a SORT for multiple time where the SORT card will be dynamically changed using the SYMNAMES.

An example as below:
Code:
//SYMNAMES DD *                                     
FIELD1,'ZZZZ',FIELDA,'YYYY'
FIELD1,'WWWW',FIELDA,'XXXX'
......................


SORT CARD:
Code:
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                               
INREC IFTHEN=(WHEN=(1,5,CH,EQ,FIELD1),BUILD=(1,19,20:FIELDA)) 
/*


Can someone let me know if there is a way to achieve this?

Thanks,
Nirmal
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Aug 24, 2011 3:45 pm    Post subject: Reply to: Re-running the SORT for different SYMNAMES
Reply with quote

Not sure what you are trying to do. Do you mean similar sort of thing to an 88-level in Cobol?
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 3:53 pm    Post subject:
Reply with quote

Not 88-Level thing in cobol.

But the SORT card to run multiple times for each line coded in SYMNAMES.

It's like looping the SORT card to execute multiple time and each time with a different value.

As i understand this will make the sort card to scan the file multiple times from start to end (for each line in symnames), which i think is not possible.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Wed Aug 24, 2011 7:26 pm    Post subject:
Reply with quote

Quote:
It's like looping the SORT card to execute multiple time and each time with a different value
kedianirmal,

I am not sure what exactly you're trying to achieve here. Multiple times on the same input file?? Why would there be such a requirement?
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 7:51 pm    Post subject:
Reply with quote

Arun,

I have option to achieve this using a COBOL program. But i just wanted to check if its possible to do the same using SORT as there is not much logic involved here other then replacing a particular byte for a matching field.

May be too much of expectation from SORT.

Regards,
Nirmal
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 24, 2011 8:08 pm    Post subject:
Reply with quote

kedianirmal wrote:
May be too much of expectation from SORT.


actually,
I think the problem is
that you expect too much
and you have provided too little info.

no rules,
no input,
no expected output.

no input from you
no output from us.
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 8:38 pm    Post subject:
Reply with quote

Sorry Dinasour Sir,
I was trying to explain the issue in Business terms but now lets get a little Techie. Please find below the details:

Input File:
Code:
1-4    5-19         20-23  24-30           (Record Bytes )
0003 12345678901234 AAAA   XXXXXXX
0003 12345678901234 BBBB   XXXXXXX

0004 12345678901234 CCCC   XXXXXXX
0004 12345678901234 DDDD   XXXXXXX
0004 12345678901234 AAAA   XXXXXXX
0004 12345678901234 BBBB   XXXXXXX
0004 12345678901234 CCCC   XXXXXXX
0004 12345678901234 EEEE   XXXXXXX

0007 12345678901234 AAAA   XXXXXXX
0007 12345678901234 BBBB   XXXXXXX
0007 12345678901234 CCCC   XXXXXXX
0007 12345678901234 EEEE   XXXXXXX
0007 12345678901234 FFFF   XXXXXXX
0007 12345678901234 ZZZZ   XXXXXXX

0008 12345678901234 AAAA   XXXXXXX


SYMNAME Parameter
Code:
//SYMNAMES DD *                                     
FIELD1,'AAAA',FIELDA,'0005'
FIELD1,'BBBB',FIELDA,'0010'
FIELD1,'FFFF',FIELDA,'0012'



SORT CARD:
Code:
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                               
INREC IFTHEN=(WHEN=(20,4,CH,EQ,FIELD1),BUILD=(1,4:FIELDA,5,25))
/*


Expected output
Code:
1-4  5-19            20-23  24-30
0005 12345678901234 AAAA   XXXXXXX
0010 12345678901234 BBBB   XXXXXXX

0005 12345678901234 AAAA   XXXXXXX
0010 12345678901234 BBBB   XXXXXXX

0005 12345678901234 AAAA   XXXXXXX
0010 12345678901234 BBBB   XXXXXXX
0012 12345678901234 FFFF   XXXXXXX

0005 12345678901234 AAAA   XXXXXXX


Hope this explains what I am expecting.

Regards,
Nirmal
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Aug 24, 2011 9:09 pm    Post subject:
Reply with quote

kedianirmal wrote:
[...]
SYMNAME Parameter
Code:
//SYMNAMES DD *                                     
FIELD1,'AAAA',FIELDA,'0005'
FIELD1,'BBBB',FIELDA,'0010'
FIELD1,'FFFF',FIELDA,'0012'



SORT CARD:
Code:
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                               
INREC IFTHEN=(WHEN=(20,4,CH,EQ,FIELD1),BUILD=(1,4:FIELDA,5,25))
/*


[...]


Nirmal,

Can you give us an extract from the manual which indicates why you think this would work?

Also what is your source for this:

Quote:
As i understand this will make the sort card to scan the file multiple times from start to end (for each line in symnames), which i think is not possible.


It seems that what you are trying to do is a "mapping".

Code:
If FIELD1 = AAAA then FIELDA set to 0005
If FIELD1 = BBBB then FIELDA set to 0010
If FIELD1 = FFFF then FIELDA set to 0012


Is that it?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 24, 2011 9:28 pm    Post subject:
Reply with quote

Code:
INREC IFTHEN=(WHEN=(20,4,CH,EQ,FIELD1),BUILD=(1,4:FIELDA,5,25))


that will make you lrec 30 char, fb.

in the event that the lrec is larger,
you can preserve the length by using OVERLAY
Code:

INREC IFTHEN=(WHEN=(20,4,CH,EQ,C'AAAA'),OVERLAY=(1:C'0005')),
      IFTHEN=(WHEN=(20,4,CH,EQ,C'BBBB'),OVERLAY=(1:C'0010')),
      IFTHEN=(WHEN=(20,4,CH,EQ,C'CCCC'),OVERLAY=(1:C'0012'))


Granted, it means using 3 IFTHENs,
but then means SORT doesn't have the overhead of a SYSNAMES file to
  • allocate
  • open
  • read
  • process - substitution of the control cards
  • close
that probably takes nanoseconds.

whoooooops, just noticed that this was in the SYNCSORT forum,
so ignore my post
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 24, 2011 9:45 pm    Post subject:
Reply with quote

Hello,

If i understand what you propose (looping) the input file would have to be re-read for each iteration. Many (most) places would find this unacceptable. . . . What if the file contains hundreds of millions of records?

Why not select all of the records you want in one pass and then sort/format the output in one go?
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 10:06 pm    Post subject:
Reply with quote

Yes Bill, I am trying to do a mapping and replace the value.

Dick Brenholtz, Above I have given the example of just 3 such cases, but it can be more or can be less. The number of parameter will keep varying.

d.sch,
Yes I agree for huge data it will be problem as the file needs to be re-read from start.

There can also be a case:
If FIELD1 = AAAA
If FIELD1 = BBBB
If FIELD1 = FFFF
then FIELDA set to 0005
If FIELD1 = CCCC
If FIELD1 = DDDD
If FIELD1 = EEEE
then FIELDA set to 0010

So basically the inputs in SYMNAMES will be keep changing on Ad-Hoc basis.

As i mentioned at first, I am just trying to understand if SORT can help to achieve this.

Regards,
Nirmal
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Aug 24, 2011 10:13 pm    Post subject:
Reply with quote

Dick Brenholtz,

I dont want users to change the SORT card everytime as a missing comma or braces will make it fail.
Changing the SYMNAMES paramter will be easy as only thing changing is the 4 values in quotes.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Aug 24, 2011 10:32 pm    Post subject: Reply to: Re-running the SORT for different SYMNAMES
Reply with quote

Nirmal,

That is all very well, but you haven't come up with a single piece of evidence that this is not just "pie in the sky".

You can't just invent stuff and imagine how nice it would be if it worked that way.

How about doing it in an "exit", if you are sorting the file anyway?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 24, 2011 11:23 pm    Post subject:
Reply with quote

Hello,

Quote:
I dont want users to change the SORT card everytime as a missing comma or braces will make it fail.
Changing the SYMNAMES paramter will be easy as only thing changing is the 4 values in quotes.
Suggest you focus on implementing something on based on something other than "what you want". . . If a person is to overtype the symnames, there will be typo's there the same as typing sort control statemement.

You might consider presenting the user with a screen on which they would enter the values and the code that processes the screen could validate the entries. When good, the jcl (symnames or not) cold be generated and used for the run.

Quote:
You can't just invent stuff and imagine how nice it would be if it worked that way.
You can if you have the skill and permission/direction to do so. . . icon_wink.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Aug 24, 2011 11:39 pm    Post subject: Reply to: Re-running the SORT for different SYMNAMES
Reply with quote

Hi Dick,

I was meaning "in somebody else's product" :-)

I suppose if you think about it as "I have some mapping to do, the amount of mapping and the values can vary from run to run, and I want to do the physical mapping on the file with my SORT product"...

Oh, that could be the requirement! Now we've got that, just too late for your solution, which sounds to me like a good way to go. Mind you, there's all that "work" to do to do it properly :-)

To do to do. Now, what song is that a line from...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 25, 2011 9:51 pm    Post subject:
Reply with quote

I really have no clue on what the OP is trying to do here. Why does n't he go for a series of IFTHENs as dick suggested. What's the variable parameter here. On what basis is this "varying"?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 10:38 am    Post subject:
Reply with quote

Hi Arun,

My guess is that someone thought of somethng "clever" and now there is reluctance not to use it. . .

@Nirmal
Quote:
There can also be a case:
If FIELD1 = AAAA
If FIELD1 = BBBB
If FIELD1 = FFFF
then FIELDA set to 0005
If FIELD1 = CCCC
If FIELD1 = DDDD
If FIELD1 = EEEE
then FIELDA set to 0010


This too can be handled in one pass (if i understand the requirement).

To repeat:
There is no good/business reason to read the filke over and over. Even if the process is implemented useing something other than the sort.

Again, if i understand, this CAN be done using the sort. . .
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

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 convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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