Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
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.
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
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.
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
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
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?
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
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.
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
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.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
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. . .
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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...
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
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"?
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
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. . .