Q2C - Translate QuickJob Programs to COBOL

                 

Overview

The Q2C software is designed to convert Quikjob source programs automatically to high-quality Cobol programs, using the Automatic Mass Processing technology that has formed the basis of our software for over 20 years. Q2C is not a GSF product and is marketed and distributed by LOGOS Computer Services LTD which is a UK registered company, the developers of this software tool.

The software converts both VSE and MVS Quikjob programs to IBM Enterprise Cobol (or the equivalent). As well as the source material, the customer has to supply certain information that is not explicitly specified in Quikjob. This includes the position and length of VSAM key fields, and, in the case of MVS Quikjob, some information needed to create File Descriptions (fixed/variable format, record-length, ddname ...).

Q2C  converts both VSE and MVS Quikjob programs to IBM Enterprise Cobol (or the equivalent). At present, the software used to perform the conversion is run on our Labs as part of a complete conversion service. We do not supply it as an “end-user” product, for two principal reasons:

  1.  Most Quikjob programs are on VSE sites, but the Q2C software itself runs only under MVS.

  2. Although the syntax conversion from Quikjob to Cobol is fully automatic, there may be cases where the program logic has to be modified in order to convert the program correctly. This is a manual process which needs to be done by someone with the experience to recognize such cases.

 

Q2C currently supports the following QuikJob verbs: ABEND, ACCEPT, ACCUM, ADD, ADDRECORD, ATEND, BREAK, CALL, CALL QUIKDATE, CALL QUIKVSAM, CHECKBREAKS, CLOSE, CONDATE, DELETE, DISPLAY, DIVIDE, DOHEADERS, DROP, EJECT, END, EQU, EXDATE, EXIT, GET, GOTO, HDR, IF, LIMITREADS, LINECOUNT, LOAD, MOVCOND, MOVE, MOVEXPD, MOVNUM, MOVZONE, MULTIPLY,  MSHIFT,  OPEN, OPTION, OR, PAGETOTALS, PAGEWIDTH, PERFORM, PRINT, PRINTCHAR, PRINTHEX, PUNCH, READ, RELEASE, REPORT, RETURN, REWRITE, SAMPLE, SET, SETGENKEY, SKIP, SORT, SUBTRACT, TABLSORT, TABLSPEC, TITLE/TITLE2, TRACE, TRAN, TRNT, WHEN, WRITE, XOR. Additional verbs will be supported in the future, as needed.

Running the Q2C LCP

Q2C is a mass-processing tool which can process the entire content of a JCL library in a single run, ignoring the members which do not contain QuikJob programs. Member lists can be specified by the user to select or ignore certain QUIKJOB members.

//BRIANAQC JOB 'Q2C20',CLASS=A, 
// MSGCLASS=X, 
// REGION=0M, 
// TIME=1, 
// LINES=50, 
// NOTIFY=&SYSUID 
//* 
//*------------------------------------------------------------------* 
//PROCS JCLLIB ORDER=(BRIANA.Q2C.CNTL, 
// BRIANA.K0.CNTL) 
//* 
//JOBLIB INCLUDE MEMBER=$JOBLIB 
//* 
//******* D E S C R I P T I O N ***************************************
//* *
//* Product: Reform/Quikjob to Cobol *
//* 
//********************************************************************* 
//Q2C20 EXEC Q2C20,MSL='*' 
//*Q2C20.MBRLIST DD DSN=BRIANA.Q2C.CNTL($TITMSL),DISP=SHR 
//Q2C20.MBRLIST DD * 
ACCUM2 
SAMPLE21 
/* 

Conversion Examples

The following example demonstrate the capabilities of the Q2C LCP for converting QuickJob source statements to COBOL..

  1. QuickJob reporting program which is converted to COBOL.

Example

Original QuickJob Source Code

OPTION SEQCHK=NO,WSTSIZE=4000,STMTEND=65,STMTS=900,GENSIZE=12200
   *
INFTAPE00000018SSYS010REWIND=UNLOAD,BS=18000
DETTAPE00000214SSYS011REWIND=UNLOAD,BS=21400
   *
    TABLSPEC 0040 01 03   04 48
   *
EQU GROUP  TSA1
EQU TYPE   TSA2
EQU PRIZM  TSA3
EQU MAILED TSA4-7-P 0C
EQU ORDERS TSA8-11-P 0C
EQU SALES  TSA12-16-P 2C
EQU CREDIT TSA17-21-P 2C
EQU DESC   TSA22-51
   *
EQU AMOUNT DET55-58-P 2
EQU REMIT  DET59-62-P 2
EQU BADEST DET109-111-P 2
EQU BADDBT DET206-209-P 2
   *
EQU SPU    WST1-3-P 2
EQU AMTREM WST4-8-P 2
EQU WSBDF  WST9-13-P 4
EQU WSCSF  WST14-18-P 2
   *
    REPORT GROUP
           TYPE
           DESC
           MAILED
           ORDERS
           SALES
           SPU
           CREDIT
   *
    SET TSA INITIAL
001 IF TSA1-2 IS HIVALUES
    GO TO 002.
    MOVE ZEROS TO TSA4-7-P
    MOVE ZEROS TO TSA8-11-P
    MOVE ZEROS TO TSA12-16-P
    MOVE ZEROS TO TSA17-21-P
    SET TSA UP 51
    GO TO 001
   *
002 GET INF
    IF INF1-5 IS HIVALUES
    GO TO 003.
    IF INF10 IS NOT EQ C'C'
    GO TO 002.
    MOVE INF10-11 TO WST2011-2012
    MOVE INF17    TO WST2013
    IF WST2011-2013 IS ONTABLE
    ADD C'1' TO TBH4-7-P
    GO TO 003.
    ADD C'1' TO CTA5-8-P
    PRINTHEX INF1-18
003 EXIT
   *
005 GET DET
    IF DET1-5 IS HIVALUES
    GO TO 100.
006 EXIT
   *
010 IF INF1-9 IS LT DET1-9
    PERFORM 002 THRU 003
    GO TO 010.
    IF INF1-9 IS GT DET1-9
    PERFORM 005 THRU 006
    GO TO 010.
    ADD C'1'         TO CTA5-8-P
    ADD C'1'         TO TBH8-11-P
    ADD AMOUNT       TO TBH12-16-P
    SUB REMIT FR AMOUNT
    MOVE AMOUNT      TO AMTREM
    MULT BADEST 2D BY C'01'  2D GIVING WSBDF 4DR
    MULT AMTREM 2D BY WSBDF  4D GIVING WSCSF 2DR
    ADD  WSCSF       TO TBH17-21-P
    PERFORM 002 THRU 003
    PERFORM 005 THRU 006
    GO TO 010
100 SET TSA INITIAL
105 IF TSA1-2 IS HIVALUES
    MOVE C'0000' TO VAL46-49
    GO TO EOJ.
    DIVD SALES 2D BY MAILED 0D GIVING SPU 2D
    PRINT REPORT
    SET TSA UP 51
    GO TO 105
999 END


 Program Source Code generated by the Q2C LCP.



       Identification Division.

      *---------------------------------------------------------------*
      * Quikjob to Cobol conversion on 2013-01-10 at 11:55:36         *
      *---------------------------------------------------------------*

       Program-Id. SAMPLE1.

       Environment Division.
       Input-Output Section.
       File-Control.
           Select Inf assign to Sys010-tape-s-inf.
           Select Det assign to Sys011-tape-s-det.
           Select Prt assign to Sys006-s-syslst.

       Data Division.
       File Section.

       FD  Inf
           recording mode is F
           block contains 18000 characters.
       01  Inf-file-rec                  Pic X(18).

       FD  Det
           recording mode is F
           block contains 21400 characters.
       01  Det-file-rec                  Pic X(214).

       FD  Prt
           recording mode is F.
       01  Prt-file-rec                  Pic X(132).

       Working-Storage Section.

      *----------------------------------------------------------------
      *    General Working-Storage fields
      *----------------------------------------------------------------

       01  Wst-area.

           05  Wst1-3-p                  Pic S9(5)       packed-decimal.
           05  Spu redefines Wst1-3-p    Pic S9(5)       packed-decimal.
           05  Spu-v2 redefines Wst1-3-p Pic S9(3)V9(2)  packed-decimal.
           05  Wst4-8-p                  Pic S9(9)       packed-decimal.
           05  Amtrem redefines Wst4-8-p Pic S9(9)       packed-decimal.
           05  Amtrem-v2 redefines Wst4-8-p
                                         Pic S9(7)V9(2)  packed-decimal.
           05  Wst9-13-p                 Pic S9(9)       packed-decimal.
           05  Wsbdf redefines Wst9-13-p Pic S9(9)       packed-decimal.
           05  Wsbdf-v4 redefines Wst9-13-p
                                         Pic S9(5)V9(4)  packed-decimal.
           05  Wst14-18-p                Pic S9(9)       packed-decimal.
           05  Wscsf redefines Wst14-18-p
                                         Pic S9(9)       packed-decimal.
           05  Wscsf-v2 redefines Wst14-18-p
                                         Pic S9(7)V9(2)  packed-decimal.
           05  Wst19-2010-filler         Pic X(1992).
           05  Wst2011-2013.
               10  Wst2011-2012          Pic X(2).
               10  Wst2013               Pic X(1).

      *----------------------------------------------------------------
      *    Input record descriptions
      *----------------------------------------------------------------

       01  Inf-rec                       Pic X(18).
       01  Inf1-18 redefines Inf-rec.
           05  Inf1-9.
               10  Inf1-5                Pic X(5).
               10  Inf6-9-filler         Pic X(4).
           05  Inf10-11.
               10  Inf10                 Pic X(1).
               10  Inf11-filler          Pic X(1).
           05  Inf12-16-filler           Pic X(5).
           05  Inf17                     Pic X(1).
           05  Inf18-filler              Pic X(1).

       01  Det-rec                       Pic X(214).
       01  Det1-214 redefines Det-rec.
           05  Det1-9.
               10  Det1-5                Pic X(5).
               10  Det6-9-filler         Pic X(4).
           05  Det10-54-filler           Pic X(45).
           05  Det55-58-p                Pic S9(7)       packed-decimal.
           05  Amount redefines Det55-58-p
                                         Pic S9(7)       packed-decimal.
           05  Amount-v2 redefines Det55-58-p
                                         Pic S9(5)V9(2)  packed-decimal.
           05  Det59-62-p                Pic S9(7)       packed-decimal.
           05  Remit redefines Det59-62-p
                                         Pic S9(7)       packed-decimal.
           05  Remit-v2 redefines Det59-62-p
                                         Pic S9(5)V9(2)  packed-decimal.
           05  Det63-108-filler          Pic X(46).
           05  Det109-111-p              Pic S9(5)       packed-decimal.
           05  Badest redefines Det109-111-p
                                         Pic S9(5)       packed-decimal.
           05  Badest-v2 redefines Det109-111-p
                                         Pic S9(3)V9(2)  packed-decimal.
           05  Det112-205-filler         Pic X(94).
           05  Det206-209-p              Pic S9(7)       packed-decimal.
           05  Baddbt redefines Det206-209-p
                                         Pic S9(7)       packed-decimal.
           05  Baddbt-v2 redefines Det206-209-p
                                         Pic S9(5)V9(2)  packed-decimal.
           05  Det210-214-filler         Pic X(5).

      *----------------------------------------------------------------
      *    Printfile record descriptions
      *----------------------------------------------------------------

       01  Prt-rec                       Pic X(132)    value spaces.

      *----------------------------------------------------------------
      *    Report record descriptions
      *----------------------------------------------------------------

       01  Report-page-header.
           05  Rep-page-date             Pic X(10)   value 'DD/MM/CCYY'.
           05  Filler                    Pic X(98)   value spaces.
           05  Filler                    Pic X(05)   value 'PAGE '.
           05  Rep-page-no               Pic ZZZ9.

       01  Report-header.
           05  Header-1-01               Pic X(05)
               value 'GROUP'.
           05  Filler                    Pic X(05)  value spaces.
           05  Header-1-02               Pic X(04)
               value 'TYPE'.
           05  Filler                    Pic X(05)  value spaces.
           05  Header-1-03               Pic X(30)
               value '.............DESC.............'.
           05  Filler                    Pic X(05)  value spaces.
           05  Header-1-04               Pic X(08)
               value '..MAILED'.
           05  Filler                    Pic X(06)  value spaces.
           05  Header-1-05               Pic X(08)
               value '..ORDERS'.
           05  Filler                    Pic X(06)  value spaces.
           05  Header-1-06               Pic X(10)
               value '.....SALES'.
           05  Filler                    Pic X(06)  value spaces.
           05  Header-1-07               Pic X(06)
               value '...SPU'.
           05  Filler                    Pic X(06)  value spaces.
           05  Header-1-08               Pic X(10)
               value '....CREDIT'.

       01  Report-line                   value spaces.
           05  Rep-group--r-x.
               10  Filler                Pic X(02).
               10  Rep-group--r          Pic X(01).
               10  Filler                Pic X(02).
           05  Filler                    Pic X(05).
           05  Rep-type--r-x.
               10  Filler                Pic X(01).
               10  Rep-type--r           Pic X(01).
               10  Filler                Pic X(02).
           05  Filler                    Pic X(05).
           05  Rep-desc                  Pic X(30).
           05  Filler                    Pic X(05).
           05  Rep-mailed                Pic Z(7)-.
           05  Filler                    Pic X(05).
           05  Rep-orders                Pic Z(7)-.
           05  Filler                    Pic X(05).
           05  Rep-sales                 Pic Z(9)-.
           05  Filler                    Pic X(05).
           05  Rep-spu                   Pic Z(5)-.
           05  Filler                    Pic X(05).
           05  Rep-credit                Pic Z(9)-.

      *----------------------------------------------------------------
      *    Table specification and sort fields
      *----------------------------------------------------------------

       01  Table-fields.
           05  Table-flag                Pic X       value 'N'.
               88 Found-in-table         value  'Y'.
               88 Table-sorted           value  'Y'.
           05  Table-search-arg          Pic X(3).
           05  Table-max                 Pic 9(6) binary value 40.
           05  Table-size                Pic 9(6) binary value 40.
           05  Tab-ind                   Pic 9(6) binary value zero.
           05  Table-element             occurs 1 to 40
                                         depending on Table-size
                                         ascending key is Tsa-arg
                                         indexed by Tab-idx.
               88 End-of-table           value high-values.
               10 Tsa-fields.
                  15 Tsa-arg             Pic X(3).
                  15 Tsa-func            Pic X(48).
               10 Filler redefines Tsa-fields.
                  15 Tsa1-2.
                     20 Tsa1             Pic X(1).
                     20 Group--r redefines Tsa1
                                         Pic X(1).
                     20 Tsa2             Pic X(1).
                     20 Type--r redefines Tsa2
                                         Pic X(1).
                  15 Tsa3                Pic X(1).
                  15 Prizm redefines Tsa3
                                         Pic X(1).
                  15 Tsa4-7-p            Pic S9(7)       packed-decimal.
                  15 Mailed redefines Tsa4-7-p
                                         Pic S9(7)       packed-decimal.
                  15 Tsa8-11-p           Pic S9(7)       packed-decimal.
                  15 Orders redefines Tsa8-11-p
                                         Pic S9(7)       packed-decimal.
                  15 Tsa12-16-p          Pic S9(9)       packed-decimal.
                  15 Sales redefines Tsa12-16-p
                                         Pic S9(9)       packed-decimal.
                  15 Sales-v2 redefines Tsa12-16-p
                                         Pic S9(7)V9(2)  packed-decimal.
                  15 Tsa17-21-p          Pic S9(9)       packed-decimal.
                  15 Credit redefines Tsa17-21-p
                                         Pic S9(9)       packed-decimal.
                  15 Credit-v2 redefines Tsa17-21-p
                                         Pic S9(7)V9(2)  packed-decimal.
                  15 Tsa22-51            Pic X(30).
                  15 Desc redefines Tsa22-51
                                         Pic X(30).
               10 Table-hit redefines Tsa-fields.
                  15 Filler              Pic X(3).
                  15 Tbh4-7-p            Pic S9(7)       packed-decimal.
                  15 Tbh8-11-p           Pic S9(7)       packed-decimal.
                  15 Tbh12-16-p          Pic S9(9)       packed-decimal.
                  15 Tbh17-21-p          Pic S9(9)       packed-decimal.
                  15 Filler              Pic X(30).

       01  Table-sort-fields.
           05  Table-store               Pic X(51).
           05  I                         Pic 9(6) binary value zero.
           05  J                         Pic 9(6) binary value zero.
           05  K                         Pic 9(6) binary value zero.

      *----------------------------------------------------------------
      *    Quikjob to Cobol conversion fields
      *----------------------------------------------------------------

           Copy Q2CVAL.

       01  Q2c-fields.
           05  Pgm--name                 Pic X(8)      value 'SAMPLE1 '.
           05  Page-count                Pic 9(4)      value zero.
           05  Lines-printed             Pic 9(3)      value 99.
           05  Lines-to-advance          Pic 9         value 1.
           05  Inf-eof                   Pic X         value space.
           05  Det-eof                   Pic X         value space.
           05  Cta5-8-p                  Pic S9(7)     packed-decimal.

      *****************************************************************

       Procedure Division.

       Initial-process Section.

           Copy Q2CINIT.

           Initialize Wst-area
           Initialize Inf-rec
           Initialize Det-rec
           Move Date--dd   to Rep-page-date (1:2)
           Move Date--mm   to Rep-page-date (4:2)
           Move Date--ccyy to Rep-page-date (7:4).
           Open input  Inf.
           Open input  Det.
           Open output Prt.
           Perform Table-input.

       Main-process Section.

           Move 1 to Tab-ind.
       Main-001.
           If Tsa1-2 (Tab-ind) is = high-values
           go to Main-002.
           Move Zeros to Tsa4-7-p (Tab-ind)
           Move Zeros to Tsa8-11-p (Tab-ind)
           Move Zeros to Tsa12-16-p (Tab-ind)
           Move Zeros to Tsa17-21-p (Tab-ind)
           Add 1 to Tab-ind
           go to Main-001.
       Main-002.
           Read Inf into Inf-rec
             at end
                Move 'E' to Inf-eof
                Move high-values to Inf-rec
           end-read
           If Inf1-5 is = high-values
           go to Main-003.
           If Inf10 is not =  'C'
           go to Main-002.
           Move Inf10-11 to Wst2011-2012
           Move Inf17    to Wst2013
           Move Wst2011-2013 to Table-search-arg
           Perform Table-search
           If Found-in-table
           Add 1 to Tbh4-7-p (Tab-ind)
           go to Main-003.
           Add 1 to Cta5-8-p
           Call 'Q2CPRHEX' using Inf1-18
             by content 'INF1-18' length of Inf1-18.
       Main-003.
           Exit.
       Main-005.
           Read Det into Det-rec
             at end
                Move 'E' to Det-eof
                Move high-values to Det-rec
           end-read
           If Det1-5 is = high-values
           go to Main-100.
       Main-006.
           Exit.
       Main-010.
           If Inf1-9 is < Det1-9
           Perform Main-002 thru Main-003
           go to Main-010.
           If Inf1-9 is > Det1-9
           Perform Main-005 thru Main-006
           go to Main-010.
           Add 1         to Cta5-8-p
           Add 1         to Tbh8-11-p (Tab-ind)
           Add Amount       to Tbh12-16-p (Tab-ind)
           Subtract Remit from Amount
           Move Amount      to Amtrem
           Multiply Badest-v2 by .01 giving Wsbdf-v4 rounded
           Multiply Amtrem-v2 by Wsbdf-v4 giving Wscsf-v2 rounded
           Add  Wscsf       to Tbh17-21-p (Tab-ind)
           Perform Main-002 thru Main-003
           Perform Main-005 thru Main-006
           go to Main-010.
       Main-100.
           Move 1 to Tab-ind.
       Main-105.
           If Tsa1-2 (Tab-ind) is = high-values
           Move  zero to Return-Code
           go to End-process.
           Divide Sales-v2 (Tab-ind) by Mailed (Tab-ind) giving Spu-v2
             remainder Div-remainder
           Perform Print-report
           Add 1 to Tab-ind
           go to Main-105.
       End-process Section.
           Goback.

       Additional-processing Section.

      *----------------------------------------------------------------
      *    Report and printfile processing sections
      *----------------------------------------------------------------

       Print-report.

           Move Group--r (Tab-ind)        to Rep-group--r
           Move Type--r (Tab-ind)         to Rep-type--r
           Move Desc (Tab-ind)            to Rep-desc
           Move Mailed (Tab-ind)          to Rep-mailed
           Move Orders (Tab-ind)          to Rep-orders
           Move Sales (Tab-ind)           to Rep-sales
           Move Spu             to Rep-spu
           Move Credit (Tab-ind)          to Rep-credit
           Move Report-line     to Prt-rec
           Perform Print-line.

       Print-line.

           If  Lines-printed >= 64
               Perform Print-report-header
           end-if

           Write Prt-file-rec from Prt-rec
             after Lines-to-advance
           Add Lines-to-advance to Lines-printed
           Move 1 to Lines-to-advance
           Move spaces to Prt-rec.

       Print-report-header.

           Move 0 to Lines-printed
           Add 1 to Page-count
           Move Page-count to Rep-page-no
           Write Prt-file-rec from Report-page-header
             after advancing page
           Write Prt-file-rec from Report-header
           Move spaces to Prt-file-rec
           Write Prt-file-rec
           Add 3 to Lines-printed.

      *----------------------------------------------------------------
      *    Table processing sections
      *----------------------------------------------------------------

       Table-input.

           Move 1 to Tab-ind
           Perform until End-of-table (Tab-ind)
               Move high-values to Table-element (Tab-ind)
               If Tab-ind < (Table-max)
                  Accept Table-element (Tab-ind)
               end-if
               If not End-of-table (Tab-ind)
                  Add 1 to Tab-ind
               end-if
           end-perform
           Move Tab-ind to Table-size
           If  Table-size > 1
               Perform Table-sort
           end-if.

       Table-sort.

           Move Table-size to K
           Move 'N' to Table-flag
           Perform until Table-sorted
               Move 'Y' to Table-flag
               Perform varying I from 1 by 1 until I = K
                 Add 1 to I giving J
                 If Tsa-arg (I) > Tsa-arg (J)
                    Move Table-element (I) to Table-store
                    Move Table-element (J) to Table-element (I)
                    Move Table-store       to Table-element (J)
                    Move 'N'               to Table-flag
                  end-if
               end-perform
               Subtract 1 from K
           end-perform.

       Table-search.

           Move 'N' to Table-flag
           Search all Table-element
               when Tsa-arg (Tab-idx) = Table-search-arg
                 Move 'Y' to Table-flag
                 Set Tab-ind to Tab-idx
           end-search.


Search key-words: ibm legacy mainframe mainframes main-frame mvs/esa os/390 z/os os390 zos vse dos/vs dos/vse vse/esa z/vse zvse Sterling QuickJob reserved words quikjob verbs qukbjob picnsave Vision:report Answer:report Quik-Job Quick-Job convert conversion translate translation unix linux HP windows server source code statements programming language needed