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

Execute same step n times with variable dsn


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 2:40 am
Reply with quote

I've seen similar questions in the forum but none exactly addresses the situation I face. I hope someone can help.

I have a job that sends a file to a printer. Before this job executes, another job creates the input for this job and the number of files varies from run to run. I can do a LISTCAT to get all the filenames that were created. I can only send one file at a time to the printer because of size constraints. I want to dynamically pass the created dataset names one by one to the send job and execute the job for each file that is passed to it. I have permission to change the send job. Any ideas?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 04, 2007 5:33 am
Reply with quote

Hello,

You could read the dataset containing the filenames creating jcl "on the fly" for each "send". You could create one job with multiple steps or multiple jobs that process one file each.

The jcl you dynamically create, would be "written" to the internal reader.

If i've not understood your request, please clarify.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 5:01 pm
Reply with quote

Hi Dick

Thanks for the reply. I suppose in your reply you're referring to accomplish this through COBOL? Am I right? I am including the guts of a program I wrote. The reason I am doubting this program is because I cannot get the JCL that's submitted from the program to abend. I need to see what the output will be if this job should abend. Any comments is appreciated.

Code:

 PERFORM VARYING WS-FNAMES-CNT FROM 1 BY 1 UNTIL             
                 WS-FNAMES-CNT > WS-NOF-FNAMES             
                                                           
 OPEN OUTPUT JOB-OUT                                         
    IF WS-FILE-STATUS NOT = "00"                           
        DISPLAY "JOB-OUT OPEN ERROR ; STATUS = "           
                                              WS-FILE-STATUS
        PERFORM ZPJFW-ABORT-HALT                           
    END-IF                                                 
*   Send JCL to output                               
    PERFORM VARYING WS-NOF-CARDS FROM 1 BY 1 UNTIL         
                    WS-NOF-CARDS > WS-CARDS-CNT             
*  Change "DSN=" in JCL                               
        IF DD-NAME (WS-NOF-CARDS) = "SYSUT1"               
            MOVE WS-FILENAME (WS-FNAMES-CNT)               
                            TO DSN-NAME (WS-NOF-CARDS)     
        END-IF                                             
        MOVE WS-JOB-CARD (WS-NOF-CARDS)                     
                            TO JOB-OUT-REC                 
*  To force a JCL error.           
        MOVE ALL "X"        TO JOB-OUT-REC                 
        WRITE JOB-OUT-REC                                   
    END-PERFORM                                             
*  Submit job automatically to JES via Internal Reader     
    CLOSE JOB-OUT                                           
    IF WS-FILE-STATUS NOT = "00"     
        DISPLAY "JOB-OUT CLOSE ERROR ; STATUS = "           
                                              WS-FILE-STATUS
        PERFORM ZPJFW-ABORT-HALT                           
    END-IF                                                 
END-PERFORM.


My jcl follows :

Code:

//STEPRUN  EXEC PGM=SPLITFIL,COND=(0,GT)                               
//*                                                                     
//STEPLIB  DD DSN=MY.STEP.LIB,DISP=SHR                       
//SYSOUT   DD  SYSOUT=*                                                 
//SYSABOUT DD  SYSOUT=*                                                 
//IDCAMS   DD  SYSOUT=*                                                 
//CEEDUMP  DD  SYSOUT=*                                                 
//*                                                                     
//JOBIN    DD DSN=MY.JCL.PDS(SENDJOB),DISP=SHR               
//FNAMES   DD DSN=MY.INPUT.FILENAMES.SEQ,                       
//         DISP=SHR                                                     
//JOBOUT   DD SYSOUT=(A,INTRDR)                                         
//*---------------------------------------------------------------------
Code:
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 04, 2007 7:07 pm
Reply with quote

You're welcome icon_smile.gif

COBOL works well. You could use other tools also. . .

Quote:
The reason I am doubting this program is because I cannot get the JCL that's submitted from the program to abend
I'm not clear on why the submitted jcl needs to abend icon_confused.gif

One way to see the output of an abend is to compile a "special" version of the program that will be run within the submitted jcl, and cause an 0c7.

It appears thet the JOB statement will be written too many times. The XXXXX's statement could cause a jcl error, but should not cause an abend.

If you post the output of the program (rather than sending it thru the internal reader), that may help as well..
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 8:25 pm
Reply with quote

Me again Dick

I've taken note of the points you've raised. Regarding the job statement, do you suggest submitting only the step from the second submission onwards? Can you submit a step on it's own to the Internal Reader? Ive decided to take the COBOL route to solve this situation. Thank you very much for your input 'till now.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Sep 04, 2007 8:30 pm
Reply with quote

You can submit only JOBS to the internal reader not individual steps.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 04, 2007 8:36 pm
Reply with quote

Hello again icon_smile.gif

Quote:
Regarding the job statement, do you suggest submitting only the step from the second submission onwards?
I suggest submitting one job with "all of the steps" or several jobs with one step each - whichever better suits your requirement.

Ooops, I was reading the code incorrectly icon_confused.gif Too quickly, i read WS-JOB-CARD as the JOB statement icon_redface.gif

Is your question about an abend resolved?

Quote:
Can you submit a step on it's own to the Internal Reader?
No, when you submit, a JOB needs to be submitted.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Sep 04, 2007 8:50 pm
Reply with quote

Thanks guys

My question about the abend is not really solved. I tried to abend the job so I could see where the output of the abend would be and what it will look like.
Back to top
View user's profile Send private message
bijumon

New User


Joined: 14 Aug 2006
Posts: 20
Location: Pune,India

PostPosted: Fri Sep 07, 2007 4:54 pm
Reply with quote

Hi donevin,

you can also try using an array, to build the JOB, i.e. the entire job, and then (instead of using write), you can use a Perform Until, and just display wahtever is in the array, this was you can build the entire JCL and then finally do a submit to the INTRDR. As the sysout is mapped to the INDRDR in the JCL the next job would be submitted.



Please get back if iam not clear.


Thanks,
---------
Biju.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Sep 07, 2007 9:10 pm
Reply with quote

Hello,

Quote:
My question about the abend is not really solved. I tried to abend the job so I could see where the output of the abend would be and what it will look like.
You could make a version of the program that will intentionally cause a s0c7. You would then see what happens to with the output.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Sat Sep 08, 2007 12:32 am
Reply with quote

donevin wrote:
I want to dynamically pass the created dataset names one by one to the send job and execute the job for each file that is passed to it. I have permission to change the send job. Any ideas?


Following this topic I got lost......... If the quotet is all wouldnt a symbolic parameter do? This parameter might be generated by a job to submit the receiving job via the internal reader......... Or do I completely miss the point ( i.s S0C7???????????)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Sep 09, 2007 4:01 am
Reply with quote

Hi George,

Quote:
Or do I completely miss the point
I believe you "have" the point. As the job(s) are submitted thru the internal reader, i believe generating the value for a symbolic parameter should work pretty much the same as generating the dsn in the dd.

Much of the topic concerned seeing what happens if the submitted job abends, so we sort of got away from the main question.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Mon Sep 10, 2007 8:38 pm
Reply with quote

For some reason I don't get alerts on topics that I watch anymore. Anyway, I've actually tested and handed this solution over to the person who needed help. The JCL that had to be changed on the fly is quite small and so this job is running quite fine. I had to reduce the jobs to one since I was testing on Mainframe Express and am only allowed to submit one job to the INTRDR per run. I want to ask a question Biju, if you don't mind? How exactly would the submit to the INTRDR take place as indicated by you in your response? Thanks again guys for all your input.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Mon Sep 10, 2007 11:35 pm
Reply with quote

From the dear JCL manual: SYSOUT and INTRDR
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top