View previous topic :: View next topic
|
Author |
Message |
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi ,
I have requirement as follows,In an input file there will be only one record(FB file) of four characters, I need to check each character and I need to set maxcc based on it’s value. This should be done in JCL either preferably within 2 steps. please let me know if there is any feasibility for achieving this. Thanks in advance for your co-operation. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I for one am totally lost on exactly what it is that you want to achieve.
And as for doing it in JCL, you have been on this forum long enough to know the stupidity of that statement. Surely by now you have learnt that JCL only executes programs, so which program do you want to execute.
You say that you check each 4 characters and set the maxcc (I am sure that you really do mean to use the correct terminology of RETURN CODE) accordingly.
OK, so today is not psychic day, how about giving out some useful information that might help people understand and resolve your problem.
And what the hell has this got to do with VSAM ??? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
GaganGarg wrote: |
I have requirement as follows,In an input file there will be only one record(FB file) of four characters, I need to check each character and I need to set maxcc based on it’s value. This should be done in JCL either preferably within 2 steps. please let me know if there is any feasibility for achieving this. Thanks in advance for your co-operation. |
Write a COBOL program - READ the file, use reference modification and tally the read-character and move the appropriate value to RETURN-CODE special register. Execute this program in Your JCL.
If you are looking for executing some utility using JCL, for instance if it is SORT - search for NULLOUT. |
|
Back to top |
|
|
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Thanks Anuj,
I have used the following JCL:
Code: |
//STEP1 EXEC PGM=SORT,PARM='NULLOUT=RC16'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,1,CH,EQ,C'1')
|
Likewise, I can Check any number of columns in the JCL. Thanks for the Hint.
Expat,
Sorry for not putting the requirement clearly. Here it is:
I wanted to check the First four columns of a PS file which is having only one record.
If First column is having value '1', Then I need to execute a PROC1 otherwise not.
If 2nd column is having value '1', Then I need to execute a PROC2 otherwise not. And, So on.
So i will be having four steps in the Job, one step for each column value from 1-4 and four conditionally executed procs.
Thanks! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
just being picky ...
what if all four columns contain a 1 ?
wouldn' t an appropriate scheduler setup satisfy better the OVERALL requirement ? |
|
Back to top |
|
|
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
All four Procs will be executed. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Why do you use "INCLUDE COND" - if just RC (?? - please read again what expat has said) is your concern, use :
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
OMIT COND=(1,80,S,EQ,C'T')
/* |
Also, if all the four characters are different, use "SS" instead of "CH", that way position of the character will not be a constraint -- just my thought. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
then a single return code would not be enough ! |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
This is pseudo code...
Step1 check col1
Step2 check col2
Step3 check col3
Step4 check col4
Later...
IF STEP1.RC = 0 THEN
CALL PROC1
ENDIF
IF STEP2.RC = 0 THEN
CALL PROC2
ENDIF
ETC...
I am betting the next question will be....
Can this be done in one step? That is the requirement.
My answer is: I do not know or care.
Those four steps will run in a total of 0.04 CPU time or less.
While a more elegant solution may be possible the end result will be the same. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Enrico, I beg to differ
If the four byte file was read into REXX, then that in itself could be used to set the RC.
I assume here that the values of said 4 bytes would be only 0 or 1
Read the file in, set the RC to the value of the parse variable, and then execute conditionally using IF/THEN/ELSE/END statements.
YES, I know, convoluted and fussy, but hey, it will work |
|
Back to top |
|
|
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Thanks Anuj for your reply.
Actually the thing is, In my project, Four jobs are running in parallel.
Say Job a, Job b, Job c and Job d
So four files are coming from there four jobs:
File a, File b, File c, File d.
And at the end of each job we are Overlaying a record in the same PS file.
First byte: 1 for Failure and 0 for Successful run of the job a
2nd byte: 1for Failure and 0 for Successful run of the job b
and so on.
At the end of these jobs, we need to merge the files File a, File b, File c and File d in another job Job E.
Now suppose one of the job fails say Job a, Then the O/p file File 'a' of Job 'a' may or may not have Valid and full data. So we want to empty this file before doing the merging.
For this purpose, we will be checking the First byte (through four) of The PS file. If it 1 then we will call a proc1(through 4) will empty FIle 'a'. otherwise PROC1 will not be executed.
I hope now It is clear. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Now more information comes to light
If it were me, this is what I would do.
In each of the four Jobs, since you know if it worked or not (you overlay the 0 or 1), code this at the end of the Job (pseudo code):
IF Success
Write MY.OUTPUT.DATA TO MY.OUTPUT.DATA.FINAL (using sort or idcams)
ELSE
Write EMPTY.FILE TO MY.OUTPUT.DATA.FINAL (or just create it as new)
ENDIF
Then use the four FINAL files as input into your merge.
This is yet another example incomplete initial explainations wasting the time of those willing to help. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Gagan- you 100th post, actually, changes everything about this thread. I'll go with what daveporcelan has suggested - that's the neat solution. I too had posted the similar solution but it would have been a repetition, so I've deleted that.
By the way, are you executing some COBOL-program/utility in some step and using COND=ONLY in for that, to append 0/1 to the file -- if so, why not execute a dummy IEFBR14 step to create an empty file in that step itslef? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Another way to do this is to set the condition code using "powers of 2". . .
When processing the 4 "switches" accumulate the value for the return-code rather than only "moving" to it (use a WS variable and when done move it to return-cide). If the first switsh is set - add 1, if the second is set - add 2, the third - add 4, and the 4th - add 8. If the input value was 0101, the return code would be 10.
Then test the return code in the jcl to determine which step(s) to execute. . . |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Topic locked, per the request by OP.
Thanks, |
|
Back to top |
|
|
|