mardi 2 novembre 2021

If else in sort JCL

I have a requirement that,in COBOL program I have to concatenate few fields based on condition and in JCL need to sort based on that concatenated result. This is one of the steps in my program. I will be able to concatenate and do other process in COBOL.

The Issue
I need to sort same file for 2 conditions..I have tried with ifthen outrec build..i can build it.after that based on 2 condition how to sort with1 pass input..anyone can suggest..

Here is the layout:

  01 Main.
     03 A.    
       05 ws-Pc.  Pic x(1).
       05 filler  Pic x(5).
     03 B.  Pic x(4).
     03 C.  Pic x(4).

     03 D.  Pic 9(13)V99.
     03 E.  Pic  x(13).

 If. ws-Pc = 3
   Concatenate. Temp= A||B||C 
 Else
    Concat. Temp= A||B||C||E
 End-if.

In Jcl I need to do the sort logic for above condition separately..

  If ws-Pc=3
    Sort(fieldA,fieldB)
  Else
    Sort(fieldA,fieldB,fieldD)
  End-if.

Please suggest any solution for a batch SORT in JCL for the above condition.. Thank you!!

Aucun commentaire:

Enregistrer un commentaire