Page 1 of 1

How to execute job step reverse order

PostPosted: Wed Mar 06, 2013 11:29 pm
by gunesh
How to execute job step reverse order without use IEBEDIT utility?

Re: JCL

PostPosted: Wed Mar 06, 2013 11:36 pm
by enrico-sorichetti
please a moderator move the topic to the stupid questions section :geek:
also why post a topic with the title jcl in the cobol section ???

Re: JCL

PostPosted: Wed Mar 06, 2013 11:38 pm
by Akatsukami
You didn't read any of the rules for posting here, kusomushi, did you? :x

The answer is simply to use another tool, as Rexx or your shop's sort product, to rearrange the steps. Of course, even a software engineer would never actually do so foolish a thing.

Re: JCL

PostPosted: Thu Mar 07, 2013 12:14 am
by Robert Sample
enrico: topic moved.

gunesh: WHY would you want to do such a thing? Usually a job consists of a set of programs that are executed sequentially because the output of the first step is used by the program in the second step and so forth. Reversing the steps means you will have programs executing before their input data is available, or is not sorted correctly.

Re: JCL

PostPosted: Thu Mar 07, 2013 12:34 am
by BillyBoyo
I think I'd use the editor, use M(ove) and A(fter) until the task is comlete. Then SUBmit. Then CANcel, as the whole thing seems pointless.

Re: How to execute job step reverse order

PostPosted: Thu Mar 07, 2013 7:51 pm
by Ed Goodman
Man, that is one DOOZY of a first post.

I spent a few minutes trying to decipher it, but no luck. The implication is that IEB* can do what they need. But I can't transform that into any useful tasks in my mind.

Do they really mean data?

Re: How to execute job step reverse order

PostPosted: Fri Mar 08, 2013 11:46 am
by gunesh
I am fresher in mainframe and looking for job.

I know that it is foolish question,

But why this question asked during interview.

:)

Re: How to execute job step reverse order

PostPosted: Fri Mar 08, 2013 12:33 pm
by enrico-sorichetti
that' s what usually foolish interviewers do ...
they ask foolish questions ;)

and ... why didn' t You say so from the beginning ???
( that it was an interview question You were asked )

Re: How to execute job step reverse order

PostPosted: Fri Mar 08, 2013 8:05 pm
by Ed Goodman
From some of the horror stories I've heard from some of my sub-continental co-workers, I'd guess it was a set up.

Some companies are forced to interview people they don't want to hire, so they have questions like this. It allows them to say that none of the people who applied were able to answer the questions. Then they can hire the friend/cousin/brother that was already promised the job.

Sorry that's inflammatory, it's just what I've been told.

Re: How to execute job step reverse order

PostPosted: Sat Mar 09, 2013 7:13 am
by BillyBoyo
Well, there's always DFSORT to the rescue:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION EQUALS
  INREC IFTHEN=(WHEN=INIT,
  OVERLAY=(81:C'257')),
        IFTHEN=(WHEN=INIT,
                  PARSE=(%00=(STARTAFT=BLANKS,FIXLEN=5))),
        IFTHEN=(WHEN=INIT,
                  OVERLAY=(84:%00)),
        IFTHEN=(WHEN=GROUP,
                  BEGIN=(1,2,CH,EQ,C'//',
                     AND,3,1,CH,NE,C'*',
                     AND,84,4,CH,EQ,C'EXEC '),
                  PUSH=(81:ID=3))
  SORT FIELDS=(81,3,CH,D)
  OUTREC BUILD=(1,80)
                                                         
//SORTIN   DD DATA,DLM=ZZ
//TEXT JOB STUFF
// OTHER STUFF BEFORE FIRST STEP
// EXEC 1
//* EXEC PART OF STEP 1, BUT A COMMENT
// 1
// EXEC 2
// 2
// EXEC 3
// 3
ZZ


Produces this:

//TEXT JOB STUFF                     
// OTHER STUFF BEFORE FIRST STEP     
// EXEC 3                             
// 3                                 
// EXEC 2                             
// 2                                 
// EXEC 1                             
//* EXEC PART OF STEP 1, BUT A COMMENT
// 1                                 


The record is "extended" by adding the characters "257" at position 81. 257 is more steps than you can have in a job. PARSE is then used to find the first field after one or more blanks, and five bytes are extracted. This is appended after the 257. WHEN=GROUP is used, starting if a JCL line and not a "comment" and the second extension is "EXEC ", to identify the start of a step. A 3-byte ID is PUSHed, overwriting the "257". This ID will be on all records of the group.

The data is SORTed, descending, with OPTION EQUALS, on the "257"/ID field, leaving the "job-related" statements at the top, and then producing the steps in reverse order.

This would only be of any use if there is no dependency in the steps from one to another.