QuikJob.doc - Converting Mainframe QuikJobs to uvcopy/uvqrpg - CONTENTS

CONTENTS

A1. Introduction & Overview
B1. QuikJob CONVERSION Operating Instructions
C1. QuikJob EXECUTION/TESTING Operating Instructions

QuikJob Conversion code examples - Before, After, & with Manual changes

D1. Example#1 - simple report (Zip code & Address report)
D1.   - original QuikJob Mainframe source code
D2.   - converted to uvcopy (no manual changes required)
D3.   - converted to uvqrpg, BEFORE manual changes required
D4.   - converted to uvqrpg, AFTER manual changes required
E1. Example#2 - master file update with detail file
E1.   - original QuikJob Mainframe source code
E2.   - converted to uvcopy (no manual changes required)
F1. Example#3 - master file update in place
F1.   - original QuikJob Mainframe source code
F2.   - converted to uvcopy - BEFORE manual changes
F3.   - converted to uvcopy - AFTER manual changes
G1. Example#4 - SORT AREA (RELEASE, RETURN,& record selection)
G1.   - original QuikJob Mainframe source code
G2.   - converted to uvcopy (minor manual change required)
G3.   - converted to uvcopy, AFTER manual changes required
H1. Example#5 - SORT FILE (can replace with 'uvsort')
H1.   - original QuikJob Mainframe source code
H2.   - converted to uvcopy (but replace with uvsort)
I1. Example#6a - INITialize an Indexed file (replace with script makeISF0)
I1.   - original QuikJob mainframe code
  - replacement 1 line script makeISF0
I2. Example#6b - INITialize an Indexed file with a dummy high key record
  - original mainframe code & replacement UNIX uvcopy code
J1. Example#7 - TABLE LOAD & LOOKUP
J1.   - original QuikJob Mainframe source code
J2.   - converted to uvcopy
J3.   - notes re manual changes required & possible enhancements
K1. Example#8 - control break report (sort & count accounts to be audited)
K1.   - original QuikJob Mainframe source code
K2.   - converted to uvqrpg, BEFORE manual changes required
K3.   - converted to uvqrpg, AFTER manual changes required

Goto:   Begin this document End this document UVSI Home-Page

QuikJob.doc - Converting Mainframe QuikJobs to uvcopy/uvqrpg - CONTENTS

CONTENTS - continued

L1. Example#9 - quikjob 'REPORT' conversion
L1.   - original QuikJob Mainframe source code
L2.   - converted to uvcopy BEFORE manual changes
L4.   - converted to uvcopy, AFTER manual changes
M1. Limitations & Post Conversion Fixups
- Files Types, Indexed file keys, Record size areas,
- Character vs Numeric fields (some mvc/cmc changes to mvn/cmn).
- Rewrite requires filr1 vs fili1
- uvqrpg conversions require more changes due to built in cycle
- TABLSPEC, CALL TBLSRT, IF ONTABLE, FUNction addressing,
- TABLE POINTERS or registers
- SORT AREA requires insert of 'sxo' (sort open) & 'sxs' (sort execute)
- OPEN & CLOSE changes if quikjob has any (most do not)
- embedded '+' symbols in quikjob 'EQU's converted to uvcopy $symbols
- large quikjobs (> 500 lines) need option to increase instruction storage
- more than 2 headers require changes to mark end of heading area 'h'
- CALLs to sub-programs can usually be replaced by uvcopy code
- PERFORM THRU possible problem (uvcopy returns on 1st exit)
N1. More Things to Watch Out For
 VALEQU - QuikJob internal storage area for Values & Status results
 UPSI - mainframe UPSI switch conversion equivalents
 EOF tests - testing EOF ATEND OK, but $INFEOF/VAL requires change
 I/O status - testing random read/write/update requires changes
 FILE declarations, confusion re Indexed or not
 EQU/$symbol references to fields in prior copybook
O1. vi editor Search patterns to find & fix quikjob conversion problems
 /tag0000 - EOF tests
 /tag____
/val[0-2] - VALEQU references
 /(1) - incorrect lengths
 /mvc/cmc - may have to change some mvc/cmc to mvn/cmn
 /mpy/div - multiply for extra decimal places, fields too small??
 /c\'& - &symbols, need conversion to $symbols
 /spaces, /zeros, /hivalues, /lovalues <-- check max lengths allowed
 /lodc1 - must add area code onto quikjob copybooks
 /sort area/file - insert sxo,sxs/sxg,sxp
 /lfd=& - &/$ variable names for LFD's on FILE's
 /???? - watch for character fields that should be numeric ??
Recommendation
  • Start conversion of each quikjob by searching for
    these patterns & correcting as required.
  • let the vi editor /search facility do the work for you.

Goto:   Begin this document End this document UVSI Home-Page

QuikJob.doc - Converting Mainframe QuikJobs to uvcopy/uvqrpg - CONTENTS

P1. Code Reductions - Optional
P1.  replacing multiple 'IF's with 1 'tst' instruction
P2.  using tables to lookup fields in fixed locations
P3.  using tables to scan for data anywhere within a field
P4.  using tables to search for & replace patterns within fields
 (not possible with quikjob)
Q1. Debuggin QuikJobs, 'export UVQRPGROP=d' for animation

Related Documentation

MVSCOBOL.doc
  • Converting IBM Mainframes to UNIX
  • Operating Instructions for all aspects
  • Cobol programs, JCL, Data files, etc
  • Directory design, conversion scripts, etc
  • see volume 4 of UV doc
OS3unix.doc
  • Converting Unisys OS3 Mainframes to UNIX
  • now obsolete
uvcopy3.doc
  • uvcopy instruction reference manual
  • includes alphabetic index to instructions (pages 3 & 4)
  • use whenever you need to clarify a quikjob conversion
  • see volume 2 of UV doc
uvqrpg.doc
  • uvqrpg instruction reference manual
  • see volume 2 of UV doc

Goto:   Begin this document End this document UVSI Home-Page

A1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Introduction / Overview

QuikJob is a Mainframe utility for performing file maintenance & generating reports. As the name implies it is often used for those quick 1 shot jobs (which often became regular production). The QuikJob syntax is similar to COBOL but much simpler.

This section will document how to convert mainframe QuikJobs to UNIX Vancouver Utilities (uvcopy, uvqrpg, or uvsort). We will present several examples (before & after) and illustrate any manual changes required after the automatic conversion job (quikjob2).

Converting QuikJobs will be part of a much larger project of converting a mainframe to UNIX. Please see MVSCOBOL.htm which documents the entire procedure. OS3unix.doc includes the operating instructions for the 'quikjob2' converter but does not provide many code examples.

The main reason for this separate document is to illustrate several examples of quikjob code conversions before & after, and any manual changes that may be required.

QuikJobs will be mass converted to both uvcopy & uvqrpg (in separate subdirs) & we will later decide which is best, & copy the best choice over to the live QuikJob sub-directory.

QuikJobs that are primarily file manipulations are best converted to uvcopy.

QuikJobs that create reports with multiple control & total levels are best converted to uvqrpg.

Reports without multiple control & total levels might require fewer changes with uvcopy because the quikjob instructions convert better 1 to 1 for uvcopy whereas the idea of uvqrpg is to create reports with declarations rather than instructions.

Goto:   Begin this document End this document UVSI Home-Page

B1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Operating Instructions

Converting QuikJobs will be part of a much larger project of converting a mainframe to UNIX. Please see MVSCOBOL.htm & 'OS3unix' which document the entire procedure. The QuikJob Conversion operating instructions have been extracted from part 6 of OS3unix.doc & are reproduced here.

Directories Involved

 /e3
 :-----apps
 :     :-----libs
 :     :     :-----pals
 :     :     :     :-----jcl1    <- JCL - original Mainframe JCL
 :     :     :     :-----jcl2         <-- intermediate (JPROCS expanded)
 :     :     :     :-----jcl3           - may require several iterations
 :     :     :     :-----jcl4             due to Jprocs calling Jprocs
 :     :     :     :-----jcl5         <-- final result of Jproc expander
 :     :     :     :-----jcl6         <-- after QuikJobs stripped out
 :     :     :     :-----jcl7         <-- JCL converted to UNIX scripts
 :     :     :     :-----jcls         <-- copied here for test/modify/debug
 :     :     :     :-----qjc1    <- QuikJobs - mainframe EQU's (copybooks)
 :     :     :     :-----qjc2       - optional, used if unpacking
 :     :     :     :-----qjcs       - converted to uvcopy/uvqrpg $symbols
 :     :     :     :-----qjj1    <- QuikJobs - original Mainframe source code
 :     :     :     :-----qjj2c      - converted to uvcopy
 :     :     :     :-----qjj2q      - converted to uvqrpg
 :     :     :     :-----qjj3c      - converted uvcopy (if unpacking)
 :     :     :     :-----qjj3q      - converted uvqrpg (if unpacking)
 :     :     :     :-----qjjs       - best version selected & copied here
                                      for modify/test/debug
 See the step by step operating instructions on the next page --------->

Note that directory 'qjc1' holds the EQUates for QuikJOb '++INCLUDE's The Mainframe 'EQU's are converted to the uvcopy equivalent $symbols (while copying from qjc1 to 'qjcs').

Goto:   Begin this document End this document UVSI Home-Page

B2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

'QuikJob's will be mass converted to both uvcopy & uvqrpg (in separate subdirs) & we will later decide which is best & copy the best choice over to the live QuikJob subdir. We will use the following subdirs:

qjj1
  • mainframe QuikJobs extracted from expanded JCL
qjj2c
  • output subdir for QuikJobs converted to uvcopy
qjj2q
  • output subdir for QuikJobs converted to uvqrpg
qjjs
  • final destination for QuikJobs selected from qjj2c or qjj2q

QuikJobs that create reports are probably done best with uvqrpg, but QuikJobs that are primarily file manipulations are best with uvcopy.

Note that the selection & manual copy from qjj2c/qjj2q to qjjs also protects us from inadvertently destroying a lot of manual editing that we may have done in qjjs - in the event of a mass reconversion of qjj1 to qjj2c/qjj2q.

convert All QuikJobs to BOTH uvcopy & uvqrpg


 1a. uvcopyx quikjob2 qjj1 qjj2c uop=q0i7c1  <- subdir & option for uvcopy
     ======================================

 1b. uvcopyx quikjob2 qjj1 qjj2q uop=q0i7c2  <- subdir & option for uvqrpg
     ======================================
 2a. vi qjj2c/*           - investigate to see which is best choice
 2b. vi qjj2q/*
 3a. uvlpd12 qjj2c        - OR list out ALL QuikJobs for easier look
 3b. uvlpd12 qjj2q

4a. cp qjj2c/xxxxx qjjs - select quikjob from uvcopy to final subdir 4b. cp qjj2q/xxxxx qjjs - select quikjob from uvqrpg to final subdir

NOTE
  • See section 6 in OS3unix.doc for more complete conversion instructions
    including conversion of quikjob copybooks (with quikjob1), and optional
    jobs to unpack data files with packed fields (qjunpk1/qjunpk2).

Goto:   Begin this document End this document UVSI Home-Page

B3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

<--- See prior page for mass conversion of ALL QuikJobs.

Here are the Op. Instrns. to convert QuikJobs 1 at a time, in case you need to bring over a few QuikJobs after the initial mass conversion of all QuikJobs.

Re-converting any 1 Quick Job


 1a. uvcopy quikjob2,fili1=qjj1/xxx,filo1=qjj2c/xxx,uop=c1  <- uvcopy
     =====================================================

 1b. uvcopy quikjob2,fili1=qjj1/xxx,filo1=qjj2q/xxx,uop=c2  <- uvqrpg
     =====================================================
 2a. vi qjj2c/xxx         - investigate to see which is best choice
 2b. vi qjj2q/xxx

3a. uvlp12 qjj2c/xxx - OR list out QuikJobs for easier look 3b. uvlp12 qjj2q/xxx

4a. cp qjj2c/xxx qjjs - select quikjob from uvcopy to final subdir 4b. cp qjj2q/xxx qjjs - select quikjob from uvqrpg to final subdir

NOTE
  • See section 6 in OS3unix.doc for more complete conversion instructions
    including conversion of quikjob copybooks (with quikjob1), and optional
    jobs to unpack data files with packed fields (qjunpk1/qjunpk2).

Goto:   Begin this document End this document UVSI Home-Page

C1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Executing/Testing QuikJobs (now uvcopy/uvqrpg)

The converted quikjobs will normally be executed by the UNIX scripts, converted from the original mainframe JCL.

For testing, we may want to execute a particular quikjob by itself without any other steps in the script.

Assuming the input data files are available, this page will show you how to execute the converted quikjobs with NO scripts (JCL) required.

We will illustrate using example#1. Here are the file declarations extracted from the uvcopy version (shown on page 'D2').

 fili1=${DD_PAL670W},rcs=0127,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR

The following assumes the data file directory design that was illustrated in OS3unix.doc. The relevant libraries were shown previously in this documented on page 'B1'.

sample instructions to test a quikjob

  1. export DD_PALQ670W=/e1/apps/data/pals/MSTR/palnames

  2. export DD_PRNTR=tmp/palq671.rpt

  3. export RUNLIBS=/e3/apps/libs/pals <-- for qjcs field EQUates

  4. export PFPATH4=/e3/apps/libs/pals/qjjs <-- quikjob uvcopy/uvqrpg


 5. uvcopy palq671         <-- execute quikjob sample#1
    ==============
  1. vi tmp/palq671.rpt <-- inspect output report

This job had only printer file output. If there had been data file output we could export it to the tmp subdir & inspect with 'uvhd', for example:

export DD_PAL065W=tmp/pal065w


 uvhd tmp/pal065w r63              <-- inspect output data files with uvhd
 ====================

Goto:   Begin this document End this document UVSI Home-Page

D1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1 - simple report - Original Mainframe code

 *QuikJob=palq671 -
 *
 * OBJECTIVE: PRINT THE POST OFFICE ZIP REPORT
 *
 FILE INF  DTF=MIRAM,BKSZ=4224,RCSZ=127,KEYS=NO,LFD=PAL670W
 *
 EQU   E-SORT-ZIP   INF1-5            /*  SORT ZIP CODE
 EQU   E-ACCT-NUM   INF6-14           /*  ACCOUNT NUMBER
 EQU   E-MAIL1      INF15-46          /*  STREET ADDRESS
 EQU   E-MAIL2      INF47-78          /*  CITY, STATE, ZIP CODE ADDRESS
 EQU   E-TITLE      INF79-86          /*  TITLE NUMBER
 EQU   E-STATE-LIC  INF87-95          /*  STATE LICENSE NUMBER
     HDR 1A 1$JOBNAM$                     U. S.   P O S T   O F F I C E
     HDR 1B   C O D E   R E P O R T        $TIM$       $IPLDAT$       $PG
     HDR 2A 0 TITLE    STATE LIC   ACCOUNT    MAILING ADDRESS 1
     HDR 2B  MAILING ADDRESS 2
 EQU P-TITLE         PRT1-8           /*  TITLE NUMBER
 EQU P-STATE-LIC     PRT11-19         /*  STATE LICENSE NUMBER
 EQU P-ACCT-NUM      PRT22-30         /*  ACCOUNT NUMBER
 EQU P-MAIL1         PRT33-64         /*  STREET ADDRESS
 EQU P-MAIL2         PRT67-98         /*  CITY, STATE, ZIP CODE ADDRESS
 1000 GET INF ATEND 9999
      MOVE E-TITLE     TO P-TITLE
      MOVE E-STATE-LIC TO P-STATE-LIC
      MOVE E-ACCT-NUM  TO P-ACCT-NUM
      MOVE E-MAIL1     TO P-MAIL1
      MOVE E-MAIL2     TO P-MAIL2
      PRINT
      GO TO 1000
 9999 GOTO  EOJ
      END

Goto:   Begin this document End this document UVSI Home-Page

D2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1 - converted to 'UVCOPY' - BEFORE changes

 #*quikjob=palq671 -
 #*
 #* objective: print the post office zip report
 #*
 was=i2000q32000s2000t100000
 # file inf  dtf=miram,bksz=4224,rcsz=127,keys=no,lfd=pal670w
 fili1=${DD_PAL670W},rcs=0127,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $e-sort-zip      =a0(5)                  # equ e-sort-zip inf1-5 /* sort zip code
 $e-acct-num      =a5(9)                   # equ e-acct-num inf6-14 /* account number
 $e-mail1         =a14(32)                 # equ e-mail1 inf15-46 /* street address
 $e-mail2         =a46(32)                 # equ e-mail2 inf47-78 /* city, state, zip code address
 $e-title         =a78(8)                  # equ e-title inf79-86 /* title number
 $e-state-lic     =a86(9)                  # equ e-state-lic inf87-95 /* state license number
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodv3c1=hh0(200)
 1$jobname                      u. s.   p o s t   o f f i c e        c o d e   r e p o r t        $time       $date       $pg
 0 title    state lic   account    mailing address 1                mailing address 2
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $p-title         =p0(8)                   # equ p-title prt1-8 /* title number
 $p-state-lic     =p10(9)                  # equ p-state-lic prt11-19 /* state license number
 $p-acct-num      =p21(9)                  # equ p-acct-num prt22-30 /* account number
 $p-mail1         =p32(32)                 # equ p-mail1 prt33-64 /* street address
 $p-mail2         =p66(32)                 # equ p-mail2 prt67-98 /* city, state, zip code address
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
        wtbe   filo1,h0(200),h0(200)  dump headings to outfile
 #
 tag1000 get    fili1,a0                   # 1000 get inf atend 9999.
         skp>   tag9999
         mvc    $p-title,$e-title          # move e-title to p-title
         mvc    $p-state-lic,$e-state-lic  # move e-state-lic to p-state-lic
         mvc    $p-acct-num,$e-acct-num    # move e-acct-num to p-acct-num
         mvc    $p-mail1,$e-mail1          # move e-mail1 to p-mail1
         mvc    $p-mail2,$e-mail2          # move e-mail2 to p-mail2
         putb   filo1,p0                   # print
         skp    tag1000                    # goto 1000.
 #
 tag9999 skp    tageoj                     # 9999 goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

D3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1 - converted to 'UVCOPY' - AFTER changes

 #*palq671 - sample quikjob converted to uvcopy - AFTER changes
 #+        - this quikjob would run with no manual changes
 #+        - But there would be page headings only on the 1st page
 #+        - Changes below implement page headings every 55 lines
 #+        - changes marked with '#+' or '#<--' ('#-' shows commented out line)
 #+        - most on 2nd page (tsthdr subrtn)
 #*
 #* objective: print the post office zip report
 #*
 was=i2000q32000s2000t100000
 # file inf  dtf=miram,bksz=4224,rcsz=127,keys=no,lfd=pal670w
 fili1=${DD_PAL670W},rcs=0127,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $e-sort-zip      =a0(5)                   # equ e-sort-zip inf1-5 /* sort zip code
 $e-acct-num      =a5(9)                   # equ e-acct-num inf6-14 /* account number
 $e-mail1         =a14(32)                 # equ e-mail1 inf15-46 /* street address
 $e-mail2         =a46(32)                 # equ e-mail2 inf47-78 /* city, state, zip code address
 $e-title         =a78(8)                  # equ e-title inf79-86 /* title number
 $e-state-lic     =a86(9)                  # equ e-state-lic inf87-95 /* state license number
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #+ clean up hdngs, insert blank line, add 'page####' for tstgdr subrtn  #<---
 lodv3c1=hh0(200)
 $jobname      US Post Office    Code Report    $date    page####
 title    state lic   account    mailing address 1            mailing address 2
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $p-title         =p0(8)                   # equ p-title prt1-8 /* title number
 $p-state-lic     =p10(9)                  # equ p-state-lic prt11-19 /* state license number
 $p-acct-num      =p21(9)                  # equ p-acct-num prt22-30 /* account number
 $p-mail1         =p32(32)                 # equ p-mail1 prt33-64 /* street address
 $p-mail2         =p66(32)                 # equ p-mail2 prt67-98 /* city, state, zip code address
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
 #-     wtbe   filo1,h0(200),h0(200)  dump headings to outfile    #<-- disabled
        bal    tsthdr1                #+ do 1st page headings     #<-- inserted
 #+
 #+ above wtbe dump hdngs #cmntd out & bal tsthdr1 inserted for 1st page #<--
 #+ see QJ mainline & subrtn on page 2 (#*eject col1 next line) force pg2 #<--

Goto:   Begin this document End this document UVSI Home-Page

 #+ page 2 of sample quikjob, with tsthdr subrtn for headings every 55 lines
 #+
 tag1000 get    fili1,a0                   # 1000 get inf atend 9999.
         skp>   tag9999
         mvc    $p-title,$e-title          # move e-title to p-title
         mvc    $p-state-lic,$e-state-lic  # move e-state-lic to p-state-lic
         mvc    $p-acct-num,$e-acct-num    # move e-acct-num to p-acct-num
         mvc    $p-mail1,$e-mail1          # move e-mail1 to p-mail1
         mvc    $p-mail2,$e-mail2          # move e-mail2 to p-mail2
         putb   filo1,p0                   # print
         skp    tag1000                    # goto 1000.
 #
 tag9999 skp    tageoj                     # 9999 goto eoj
 tageoj cls    all
        eoj
 #
 #------------------------------------------------------------------------
 # tsthdr - subrtn to test line count & print headings        #<-- new code
 #        - this subrtn added to original quikjob conversion
 #        - optional addition if you need headings on every page
 #        - enter at 'tsthdr1' to force page headings (at program init)
 #
 tsthdr  add    $ca21,1                increment line count
         cmn    $ca21,55               page full (do hdrs) ?
         skp<   tsthdrx
 tsthdr1 add    $ca22,1                yes - incrmnt page#
         scn    h0(150),'page'         scan for page# ID
         edt    hx4(4),$ca22,'zzz9'    insert page# following ID
         wtbe   filo1,h0(200),h0(200)  dump page hdrs to print file
         mvn    $ca21,0                clear line counter
 tsthdrx ret=                          return to caller

Goto:   Begin this document End this document UVSI Home-Page

D4. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1q converted to 'UVQRPG'(vs uvcopy) - BEFORE changes

 #*quikjob=palq671 -
 #*
 #* objective: print the post office zip report
 #*
 was=i2000q32000s2000t100000
 # file inf  dtf=miram,bksz=4224,rcsz=127,keys=no,lfd=pal670w
 fili1=${DD_PAL670W},rcs=0127,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 lodc1=qq0(32)
 $e-sort-zip      =a0(5)                   # equ e-sort-zip inf1-5 /* sort zip code
 $e-acct-num      =a5(9)                   # equ e-acct-num inf6-14 /* account number
 $e-mail1         =a14(32)                 # equ e-mail1 inf15-46 /* street address
 $e-mail2         =a46(32)                 # equ e-mail2 inf47-78 /* city, state, zip code address
 $e-title         =a78(8)                  # equ e-title inf79-86 /* title number
 $e-state-lic     =a86(9)                  # equ e-state-lic inf87-95 /* state license number
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 head6=h6000(66),'1$jobname                      u. s.   p o s t   o f f i c e'
 head6=h6066(66),'  c o d e   r e p o r t        $time       $date       $pg'
 head5=h5000(66),'0 title    state lic   account    mailing address 1'
 head5=h5066(66),' mailing address 2'
 #
 lodc1=qq0(32)
 $p-title         =p0(8)                   # equ p-title prt1-8 /* title number
 $p-state-lic     =p10(9)                  # equ p-state-lic prt11-19 /* state license number
 $p-acct-num      =p21(9)                  # equ p-acct-num prt22-30 /* account number
 $p-mail1         =p32(32)                 # equ p-mail1 prt33-64 /* street address
 $p-mail2         =p66(32)                 # equ p-mail2 prt67-98 /* city, state, zip code address
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @dtl   nop
 #
 tag1000 get    fili1,a0                 <--- see changes next page --->
         skp>   tag9999                  <-
         mvc    $p-title,$e-title           # move e-title to p-title
         mvc    $p-state-lic,$e-state-lic   # move e-state-lic to p-state-lic
         mvc    $p-acct-num,$e-acct-num     # move e-acct-num to p-acct-num
         mvc    $p-mail1,$e-mail1           # move e-mail1 to p-mail1
         mvc    $p-mail2,$e-mail2           # move e-mail2 to p-mail2
         putb   filo1,p0                    # print
         skp    tag1000                  <-
 #                                       <-
 tag9999 skp    tageoj                   <-
 tageoj cls    all                       <--- see changes next page --->
        eoj                              <-

Goto:   Begin this document End this document UVSI Home-Page

D5. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1q converted to 'UVQRPG'(vs uvcopy) - AFTER changes

 ##  <------- note changes for uvqrpg marked by '##' below
                           changes explained on the next page ---------->
 #*quikjob=palq671 -
 #*
 #* objective: print the post office zip report
 #*
 was=i2000q32000s2000t100000
 # file inf  dtf=miram,bksz=4224,rcsz=127,keys=no,lfd=pal670w
 fili1=${DD_PAL670W},rcs=0127,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 lodc1=qq0(32)
 $e-sort-zip      =a0(5)                   # equ e-sort-zip inf1-5 /* sort zip code
 $e-acct-num      =a5(9)                   # equ e-acct-num inf6-14 /* account number
 $e-mail1         =a14(32)                 # equ e-mail1 inf15-46 /* street address
 $e-mail2         =a46(32)                 # equ e-mail2 inf47-78 /* city, state, zip code address
 $e-title         =a78(8)                  # equ e-title inf79-86 /* title number
 $e-state-lic     =a86(9)                  # equ e-state-lic inf87-95 /* state license number
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 head6=h6000(66),'1$jobname                      u. s.   p o s t   o f f i c e'
 head6=h6066(66),'  c o d e   r e p o r t        $time       $date       $pg'
 head5=h5000(66),'0 title    state lic   account    mailing address 1'
 head5=h5066(66),' mailing address 2'
 #
 lodc1=qq0(32)
 $p-title         =p0(8)                   # equ p-title prt1-8 /* title number
 $p-state-lic     =p10(9)                  # equ p-state-lic prt11-19 /* state license number
 $p-acct-num      =p21(9)                  # equ p-acct-num prt22-30 /* account number
 $p-mail1         =p32(32)                 # equ p-mail1 prt33-64 /* street address
 $p-mail2         =p66(32)                 # equ p-mail2 prt67-98 /* city, state, zip code address
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @dtl   nop
 #
 ##tag1000 get    fili1,a0               <--- CHANGED see original prior page
 ##        skp>   tag9999                <-
         mvc    $p-title,$e-title           # move e-title to p-title
         mvc    $p-state-lic,$e-state-lic   # move e-state-lic to p-state-lic
         mvc    $p-acct-num,$e-acct-num     # move e-acct-num to p-acct-num
         mvc    $p-mail1,$e-mail1           # move e-mail1 to p-mail1
         mvc    $p-mail2,$e-mail2           # move e-mail2 to p-mail2
         putb   filo1,p0                    # print
 ##        skp    tag1000                <-
 #                                       <-
 ##tag9999 skp    tageoj                 <-
 ##tageoj cls    all                     <--- CHANGED see original prior page
 ##       eoj                            <-

Goto:   Begin this document End this document UVSI Home-Page

D6. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#1q conversion to uvqrpg - CHANGES EXPLAINED

<-- Please see the sample job listed on the previous page, with the changes required marked by '##'.

Note that in this case all we had to do was to remove (or ##comment out) the following instructions:

 @dtl   nop
 #
 ## tag1000 get    fili1,a0                   # 1000 get inf
 ##         skp>   tag0000
   - - - detail time instructions - - -
 ##        skp    tag1000                    # goto 1000
 ##
 ## tag9999 skp    tageoj                     # 9999 goto eoj
 ## tageoj cls    all
 ##       eoj

These instructions must be removed (or #commented out) because uvqrpg expects to create reports more by declarations rather than procedures (please see uvqrpg.doc in volume 2 of Vancovuer Utilities).

uvcopy OR uvqrpg

For this example, the uvcopy conversion requires no manual changes.

You might want to use the uvqrpg version (even though some manual changes are required), if you wanted page headings on every page (instead of only on the 1st page as per uvcopy).

uvqrpg generates page headings automatically. Of course you could add a few instructions in the uvcopy version to count lines & reprint the headings (using the 'wtbe' command).

Goto:   Begin this document End this document UVSI Home-Page

E1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#2 - Master file update with Detail file - Mainframe code

 *QuikJob=palq749  -
 *
 * OBJECTIVE: INSERT THE TAX RELIEF RECS INTO PALTRAN
 *
 FILE     INF  DTF=MIRAM,BKSZ=1024,RCSZ=63,INDXBLK=1,RCB=YES
 FILE     DET  DTF=MIRAM,BKSZ=30720,RCSZ=63,KEYS=NO,RCB=YES
          MOVE C'000000' TO SAV1-6
 0010     GET DET ATEND 9999
          MOVE DET1-63 TO INF1-63
          ADDKEY INF USING INF1-23
          IF VAL46-49 NOT EQ C'0000'
             DISPLAY C'REC NOT ADDED'
             ABEND.
          ADD C'1' TO SAV1-6.
          GOTO 0010.
 9999     MOVE C'PALTRAN RECORDS ADDED     ' TO PRT1
          MOVE SAV1-6 TO PRT30 0C
          DISPLAY PRT1-40
          GOTO  EOJ

Goto:   Begin this document End this document UVSI Home-Page

E2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#2 - Master file update with Detail - uvcopy BEFORE changes

 #*quikjob=palq749  -
 #*
 #* objective: insert the tax relief recs into paltran
 #*
 was=i2000q32000s2000t100000
 # file     inf  dtf=miram,bksz=1024,rcsz=63,indxblk=1,rcb=yes
 fili1=${DD_INF},rcs=0063,typ=ISFl1
 # file     det  dtf=miram,bksz=30720,rcsz=63,keys=no,rcb=yes
 fili2=${DD_DET},rcs=0063,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
         mvc    s0(6),c'000000'            # move c'000000' to sav1-6
 #
 tag0010 get    fili2,b0                   # 0010 get det atend 9999
         skp>   tag9999
         mvc    a0(63),b0(63)              # move det1-63 to inf1-63
         wrt    fili1,a0                   # addkey inf using inf1-23
         skp=    tag____                <-
         cmc    o45(4),c'0000'          <--- see changes next page --->
         skp=   ifb0010                 <-
         msgwa1 c'REC NOT ADDED'
         can    'ABEND - job cancelled'
 ifb0010 add    s0(6),1                    # ifb0010 add c'1' to sav1-6.
         skp    tag0010                    # goto 0010.
 #
 tag9999 mvc    p0(0022),c'PALTRAN RECORDS ADDED '
         mvc    p29(0006),s0(6)            # move sav1-6 to prt30 0c
         msgwa1 p0(40)
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj

Mainframe tested success of 'ADDKEY' as follows:

      IF VAL46-49 NOT EQ C'0000'   <- original mainframe QJ test
                                      which converted to 2 instructions:
      cmc    o45(4),c'0000'       <- not required
      skp=   ifb0010              <- use this following uvcopy 'wrt'

Goto:   Begin this document End this document UVSI Home-Page

E3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#2 - Master file update with Detail - uvcopy AFTER changes

 #*quikjob=palq749  -
 #*
 #* objective: insert the tax relief recs into paltran
 #*
 was=i2000q32000s2000t100000
 # file     inf  dtf=miram,bksz=1024,rcsz=63,indxblk=1,rcb=yes
 fili1=${DD_INF},rcs=0063,typ=ISFl1
 # file     det  dtf=miram,bksz=30720,rcsz=63,keys=no,rcb=yes
 fili2=${DD_DET},rcs=0063,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
         mvc    s0(6),c'000000'            # move c'000000' to sav1-6
 #
 tag0010 get    fili2,b0                   # 0010 get det atend 9999
         skp>   tag9999
         mvc    a0(63),b0(63)              # move det1-63 to inf1-63
         wrt    fili1,a0                   # addkey inf using inf1-23
         skp=   ifb0010                 <-- CHANGED see original prior page
 #                                      <-- 2 instructions removed
         msgwa1 c'REC NOT ADDED'
         can    'ABEND - job cancelled'
 ifb0010 add    s0(6),1                    # ifb0010 add c'1' to sav1-6.
         skp    tag0010                    # goto 0010.
 #
 tag9999 mvc    p0(0022),c'PALTRAN RECORDS ADDED '
         mvc    p29(0006),s0(6)            # move sav1-6 to prt30 0c
         msgwa1 p0(40)
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj

Mainframe tested success of 'ADDKEY' as follows:

      IF VAL46-49 NOT EQ C'0000'   <- original mainframe test I/O OK
                                      which converted to 2 instructions:
      cmc    o45(4),c'0000'       <- not required, removed above
      skp=   ifb0010              <- use this following uvcopy 'wrt'

Goto:   Begin this document End this document UVSI Home-Page

F1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#3 - Master file update IN PLACE - Mainframe code

 *QuikJob=bosfxnam.qj01
 *
 * OBJECTIVE: FIX ANY BLANK DATES IN BOSNAME FILE TO ZEROS
 *
 FILE INF DTF=MIRAM,RCSZ=1023,K1LOC=1,K1LEN=&KL,INDXBLK=&INDX
 *
 EQU     BOSNAME       INF
 ++INCLUDE BOSNAME
 *
 EQU     WSCOUNT       WST1-4
          MOVE C'0000' TO WST1-4
 *
 1000     GET   INF ATEND 9999.
          IF NDTLEN < C'00000000'
              MOVE C'00000000' TO NDTLEN.
          IF NDTLPR < C'00000000'
              MOVE C'00000000' TO NDTLPR.
          IF NDTUNC < C'00000000'
              MOVE C'00000000' TO NDTUNC.
          REWRITE INF
          ADD C'0001' TO WST1-4
          GOTO 1000.
 9999     MOVE C'TOTAL BOSNAME RECS CHANGED:' TO PRT1-30
          MOVE WST1-4 TO PRT31-34
          PRINT
          GOTO  EOJ

Goto:   Begin this document End this document UVSI Home-Page

F2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#3 - Master file update IN PLACE - uvcopy BEFORE changes

 #*quikjob=bosfxnam.qj01
 #*
 #* objective: fix any blank dates in bosname file to zeros
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,rcsz=1023,k1loc=1,k1len=&kl,indxblk=&indx
 fili1=${DD_INF},rcs=1023,typ=ISFl1           <--- CHANGE see next page --->
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $bosname         =a0(0)                   # equ bosname inf
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),bosname                     # ++include bosname
 lodc1=qq0(32)
 $wscount         =i0(4)                   # equ wscount wst1-4
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
         mvc    i0(4),c'0000'              # move c'0000' to wst1-4
 #*
 tag1000 get    fili1,a0            <--- CHANGE required, see next page --->
         skp>   tag9999
         cmc    $ndtlen,c'00000000'        # if ndtlen < c'00000000'
         skp=>  ifb0010
         mvc    $ndtlen,c'00000000'        # move c'00000000' to ndtlen.
 ifb0010 cmc    $ndtlpr,c'00000000'        # ifb0010 if ndtlpr < c'00000000'
         skp=>  ifb0020
         mvc    $ndtlpr,c'00000000'        # move c'00000000' to ndtlpr.
 ifb0020 cmc    $ndtunc,c'00000000'        # ifb0020 if ndtunc < c'00000000'
         skp=>  ifb0030
         mvc    $ndtunc,c'00000000'        # move c'00000000' to ndtunc.
 ifb0030 upd    fili1,a0              <--- CHANGE see next page --->
         add    i0(4),1                    # add c'0001' to wst1-4
         skp    tag1000                    # goto 1000.
 #
 tag9999 mvc    p0(30),c'TOTAL BOSNAME RECS CHANGED:'
         mvc    p30(4),i0(4)               # move wst1-4 to prt31-34
         putb   filo1,p0                   # print
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

F3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#3 - Master file update IN PLACE - uvcopy AFTER changes

 #*quikjob=bosfxnam.qj01
 #*
 #* objective: fix any blank dates in bosname file to zeros
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,rcsz=1023,k1loc=1,k1len=&kl,indxblk=&indx
 filr1=${DD_INF},rcs=1023,typ=ISFl1         <--- CHANGED (fili1 to filr1)
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $bosname         =a0(0)                   # equ bosname inf
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),bosname                     # ++include bosname
 lodc1=qq0(32)
 $wscount         =i0(4)                   # equ wscount wst1-4
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
         mvc    i0(4),c'0000'              # move c'0000' to wst1-4
 #*
 tag1000 redm2  filr1,a0           <--- CHANGED (get fili1 to redm2 filr1)
         skp>   tag9999
         cmc    $ndtlen,c'00000000'        # if ndtlen < c'00000000'
         skp=>  ifb0010
         mvc    $ndtlen,c'00000000'        # move c'00000000' to ndtlen.
 ifb0010 cmc    $ndtlpr,c'00000000'        # ifb0010 if ndtlpr < c'00000000'
         skp=>  ifb0020
         mvc    $ndtlpr,c'00000000'        # move c'00000000' to ndtlpr.
 ifb0020 cmc    $ndtunc,c'00000000'        # ifb0020 if ndtunc < c'00000000'
         skp=>  ifb0030
         mvc    $ndtunc,c'00000000'        # move c'00000000' to ndtunc.
 ifb0030 upd    filr1,a0           <--- CHANGED (upd fili1 to upd filr1)
         add    i0(4),1                    # add c'0001' to wst1-4
         skp    tag1000                    # goto 1000.
 #
 tag9999 mvc    p0(30),c'TOTAL BOSNAME RECS CHANGED:'
         mvc    p30(4),i0(4)               # move wst1-4 to prt31-34
         putb   filo1,p0                   # print
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj
 Note CHANGES marked above with '<--- CHANGED'
 See more explanation on the netx page ------------------>

Goto:   Begin this document End this document UVSI Home-Page

F4. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#3 - Master file update IN PLACE - CHANGES explained

Here are the original & the changed lines from the BEFORE & AFTER versions listed on the previous 2 pages

 fili1=${DD_INF},rcs=1023,typ=ISF     - as converted, before changes
 filr1=${DD_INF},rcs=1023,typ=ISF  <--- CHANGED (fili1 to filr1)
 tag1000 get    fili1,a0              - as converted
 tag1000 redm2  filr1,a0           <--- CHANGED (get fili1 to redm2 filr1)
 ifb0030 upd    fili1,a0              - as converted
 ifb0030 upd    filr1,a0           <--- CHANGED (upd fili1 to upd filr1)

The primary input file (INF) is always converted to 'fili1' which is input only & does not allow 'update in place'. If the quikjob includes 'REWRITES', you must change 'fili1' to 'filr1' (required for updates in place).

The 'get' (for input only) then becomes 'redm2' (get next allowing updates).

'REWRITE' is converted to 'upd' OK, but you must change 'fili1' to 'filr1'.

This discussion applies to uvcopy. As of July 2000, uvqrpg does not allow updates in place to the primary input file. This is because uvqrpg has a built in cycle which gets records from the primary input file.

You must use uvcopy for updates in place to the primary file, but there is no problem using uvqrpg when reading a detail sequential file as the primary & randomly updating an indexed file by key.

Goto:   Begin this document End this document UVSI Home-Page

G1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#4 - SORT AREA (RELEASE/RETURN) - Mainframe code

*QuikJob=palq065 - * * OBJECTIVE: SORT PALS TRANSACTIONS BY ACCOUNT#, ITEM#,& TAX-YEAR * FILE INF DTF=MIRAM,LFD=PALADJW,RCSZ=63,BKSZ=2048,KEYS=YES FILE OFA DTF=MIRAM,LFD=PAL065W,RCSZ=63,BKSZ=2048,KEYS=NO

 ++INCLUDE PALADJW
 EQU      SRTREC    OFA1-63           /*  SORTED ADJUSTMENT FILE
 EQU     RECCNT     WST1-4-P
     SORT AREA RL63 ON MACCT MITEM MTXYR
      MOVE P'0000' TO RECCNT
 0100 GET INF ATEND 0200               /*  READ PALADJW
      IF INF24 IS EQ HIVALUES
          GO TO 0100.
      RELEASE INF1-63 TO SORT
      ADD C'1' TO RECCNT
      GO TO 0100
 0200 RETURN SORTED INTO INF1-63 ATEND 9999   /*  READ SORTED RECORDS
      MOVE INF1-63 TO OFA1-63
      WRITE OFA
      GO TO 0200
 9999 MOVE RECCNT TO PRT5 C
      MOVE C'RECORDS SORTED' TO PRT16
      PRINT
      GOTO EOJ

This job can be rewritten (on 1 line) using 'uvsort':


 uvsort "fili1=$PALADJW,rcs=63,typ=ISF,filo1=$PAL065W,typ=RSF\
 =============================================================
         ,keys=(0,14),del=23(1):0xFF"
         ============================

The uvcopy solution (next page) would be better when there are a lot of record selections or record reformatting (uvsort would be long & awkward).

 Note that the sort keys were determined by looking up the 'paladjw' record
 layout in the 'qjcs' subdirectory for $symbols converted from original
 EQU layouts. See paladjw listed on page 'G4' ahead --------->

Goto:   Begin this document End this document UVSI Home-Page

G2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#4 - SORT AREA (RELEASE/RETURN) - uvcopy BEFORE changes

 #*quikjob=palq065  -
 #*
 #* objective: sort pals transactions by account#, item#,& tax-year
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,lfd=paladjw,rcsz=63,bksz=2048,keys=yes
 fili1=${DD_PALADJW},rcs=0063,typ=ISFl1
 # file ofa dtf=miram,lfd=pal065w,rcsz=63,bksz=2048,keys=no
 filo2=${DD_PAL065W},rcs=0063,typ=RSFl0
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),paladjw                     # ++include paladjw
 lodc1=qq0(32)
 $srtrec          =e0(63)                  # equ srtrec ofa1-63 /* sorted adjustment file
 $reccnt          =i0(4p)                  # equ reccnt wst1-4-p
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #    sort area rl63 on macct mitem mtxyr
 #
 @run
 #                                  <-- INSERT 'sxo' specify SORT rcsz & keys
        opn    all                           open files
        clr    t0(100000),'~'                clear table to all tildes
 #
         mvc    $reccnt,0                  # move p'0000' to reccnt
 #
 tag0100 get    fili1,a0                   # 0100 get inf atend 0200 /* read paladjw
         skp>   tag0200             <--- CHANGE required see next page --->
         cmc    a23(1),$hivalues           # if inf24 is eq hivalues
         skp=   tag0100                    # goto 0100. =
         sxp    a0(63)                     # release inf1-63 to sort
         add    $reccnt,1                  # add c'1' to reccnt
         skp    tag0100                    # goto 0100
 #
 #                                  <--- INSERT required see next page --->
 #
 tag0200 sxg    a0(63)                     # 0200 return sorted into inf1-63 atend 9999 /* read sorte
         skp>   tag9999
         mvc    e0(63),a0(63)              # move inf1-63 to ofa1-63
         put    filo2,e0                   # write ofa
         skp    tag0200                    # goto 0200
 #
 tag9999 mvc    p4(1),$reccnt              # 9999 move reccnt to prt5 c
         mvc    p15(0014),c'RECORDS SORTED'
         putb   filo1,p0                   # print
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

G3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#4 - SORT AREA (RELEASE/RETURN) - uvcopy AFTER changes

 #*quikjob=palq065  -
 #*
 #* objective: sort pals transactions by account#, item#,& tax-year
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,lfd=paladjw,rcsz=63,bksz=2048,keys=yes
 fili1=${DD_PALADJW},rcs=0063,typ=ISFl1
 # file ofa dtf=miram,lfd=pal065w,rcsz=63,bksz=2048,keys=no
 filo2=${DD_PAL065W},rcs=0063,typ=RSFl0
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),paladjw                     # ++include paladjw
 lodc1=qq0(32)
 $srtrec          =e0(63)                  # equ srtrec ofa1-63 /* sorted adjustment file
 $reccnt          =i0(4p)                  # equ reccnt wst1-4-p
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #    sort area rl63 on macct mitem mtxyr
 #
 @run
        sxo    63,'0(9),9(3),12(2)' #1<-- INSERTED sxo specify SORT rcsz & keys
        opn    all                          open files
        clr    t0(100000),'~'               clear table to all tildes
 #
         mvc    $reccnt,0                  # move p'0000' to reccnt
 #
 tag0100 get    fili1,a0                   # 0100 get inf atend 0200 /* read paladjw
         skp>   tag0150            #2<-- CHANGED (tag0200 to tag0150)
         cmc    a23(1),$hivalues           # if inf24 is eq hivalues
         skp=   tag0100                    # goto 0100. =
         sxp    a0(63)                     # release inf1-63 to sort
         add    $reccnt,1                  # add c'1' to reccnt
         skp    tag0100                    # goto 0100
 #
 tag0150 sxs                       #3<-- INSERTED (sxs execute sort)
 #
 tag0200 sxg    a0(63)                     # 0200 return sorted into inf1-63 atend 9999 /* read sorte
         skp>   tag9999
         mvc    e0(63),a0(63)              # move inf1-63 to ofa1-63
         put    filo2,e0                   # write ofa
         skp    tag0200                    # goto 0200
 #
 tag9999 mvc    p4(1),$reccnt              # 9999 move reccnt to prt5 c
         mvc    p15(0014),c'RECORDS SORTED'
         putb   filo1,p0                   # print
         skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

G4. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#4 - SORT AREA (RELEASE/RETURN) - CHANGES explained

We can determine the SORT fields by looking up the 'paladjw' record layout in the 'qjcs' directory (converted from original quikjob EQU directory). Here are a few fields from both directories:

qjc1/paladjw - original quikjob layout

 EQU      MKEY1     INF1-23           /*  PRIMARY KEY
 EQU      MACCT     INF1-9            /*  ACCOUNT NUMBER
 EQU      MITEM     INF10-12          /*  ITEM NUMBER
 EQU      MTXYR     INF13-14          /*  TAX YEAR

qjcs/paladjw - layout converted to uvcopy $symbols

 $mkey1           =a0(23)         #equ mkey1 inf1-23 /* primary key
 $macct           =a0(9)          #equ macct inf1-9 /* account number
 $mitem           =a9(3)          #equ mitem inf10-12 /* item number
 $mtxyr           =a12(2)         #equ mtxyr inf13-14 /* tax year

changed lines marked on prior page

 SORT AREA RL63 ON MACCT MITEM MTXYR     - original quikjob
         sxo  63,'0(9),9(3),12(2)'   #1<-- INSERTED sxo SORT rcsz & keys
         sxo  63,'0(14)'                 - could combine
         skp>   tag0200                  - original conversion
         skp>   tag0150              #2<-- CHANGED (tag0200 to tag0150)
 tag0150 sxs                         #3<-- INSERTED (sxs execute sort)

We must insert the 'sxs' for uvcopy to perform the sort. Quikjob did not need this because it automatically perfomed the sort after the last RELEASE & on the 1st RETURN (uvcopy does not do this for added flexibility).

Goto:   Begin this document End this document UVSI Home-Page

H1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#5 - SORT FILE (vs SORT AREA) - Original Mainframe

 *QuikJob=palq515  -
 * OBJECTIVE: SORT PALS BILLING EXTRACTION RECORDS IN
 *            ZIP, ACCOUNTNO, TAX YEAR,& ITEM NUMBER ORDER
 *            DROP ANY TAX YEARS < 1998
 FILE INF DTF=MIRAM,LFD=PAL510W,RCSZ=255,BKSZ=20480,KEYS=NO
 FILE OFA DTF=MIRAM,LFD=PAL515W,RCSZ=255,BKSZ=20480,KEYS=NO
 EQU      BLEXREC   INF1-255          /*  BILLING EXTRACTION RECORD
 EQU      BLSZIP    INF1-5            /*  SORT ZIP
 EQU      BLSACCT   INF6-14           /*  ACCOUNT NUMBER
 EQU      BLSTXYR   INF22-25          /*  TAX YEAR
 EQU      BLSITEM   INF26-28          /*  ITEM NUMBER
 EQU     RECCNT     WST1-4-P
     SORT FILE INF ON BLSZIP BLSACCT BLSITEM  BLSTXYR (D)
      MOVE P'0000' TO RECCNT
 0100 GET INF ATEND 9999
      IF BLSTXYR < C'1998'
         GO TO 0100.
      MOVE INF1-255 TO OFA1-255
      WRITE OFA
      ADD C'1' TO RECCNT
      GO TO 0100
 9999 MOVE RECCNT TO PRT5 C
      MOVE C'RECORDS SORTED' TO PRT16
      PRINT
      GOTO EOJ

This job can be rewritten (on 1 line) using 'uvsort':


 uvsort "fili1=$PAL510W,rcs=255,typ=ISF,filo1=$PAL510W,typ=RSF\
 =============================================================
         ,keys=(0,5,c,a,5,9,c,a,25,3,c,a,23,2,c,d),del=21(4)<1998"
         =========================================================

The Quikjob printed record counts, but uvsort automatically displays record counst when input & output files are closed.

If you really wanted to you could convert the uvcopy equivalent similar to the preceding example#4, but you would have more instructions to add since quikjob 'SORT FILE' does not include the RELEASE/RETURN as did the 'SORT AREA' of example#4.

Goto:   Begin this document End this document UVSI Home-Page

I1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#6a - FILE INIITALIZE - Original Mainframe

 ** palq022 - initialize indexed file
 ** Open & Close to init empty file with keys & rcsz
 **
 FILE OFA TYPE=MIRAM,RCSZ=31,BKSZ=2048,INDXBLK=1,K1LOC=1,K1LEN=9
 0010 OPEN OFA
      CLOSE OFA
      GO TO EOJ

This QuikJob replaced with UV script 'makeISF0', 1 line inserted into the script calling the quikjob (jcls/pals021)


 makeISF0 $DM/ipaldcal 31 0,9
 ============================

Goto:   Begin this document End this document UVSI Home-Page

I2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#6b - FILE INIT (write high-key record) - Mainframe

 *QuikJob=palq072  -
 *
 * OBJECTIVE: REINITIALIZE THE TRANSACTION FILE (PALADJW).
 *            WRITE A DUMMY HIGH-KEY NINES RECORD
 *
 FILE DET DTF=JCS
 FILE OFA DTF=MIRAM,RCSZ=63,BKSZ=2048,K1LOC=1,K1LEN=23,INDXBLK=1
 0100 GET DET                          /*  READ JCLDATA DUMMY RECORD
      MOVE DET1-63 TO OFA1-63
      WRITE OFA
      GOTO EOJ

Example#6b - FILE INIT (write high-key record) - UNIX uvcopy

 # QuikJob=palq072  -
 #
 # REINIT TRANSACTION FILE (PALADJW) by writing a DUMMY HIGH-KEY
 # - High Key value changed from '9's (mainframe) to 'z's for UNIX
 #
 filo1=$DM/paladjw,rcs=63,typ=ISF,isk1=0(23)
 #
 lod=k0(63)
 zzzzzzzzzzzzzzzzzzzzzzz dummy high key record to init file
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    filo1
        put    filo1,k0(63)
        cls    filo1
        eoj

This rewritten job would be called from the script (JCL) as follows:


 uvcopy palq072,filo1=$DM/paladjw
 ================================
 This quikjob was rewritten (rather than use the converted code)
 - Loading a table in uvcopy is a useful technique for various uses.
 - In this case it is just 1 record, but the table could have many lines
 - Most areas default to 1024 bytes, which can be increased via 'was='
   which must appear prior to the file declaration, for example if you
   wanted to load 100 lines of 63 bytes each, you could code: was=k6300
        wtb    filo1,k0(63),k0(63)

Goto:   Begin this document End this document UVSI Home-Page

J1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#7 - Table Load & Lookup - Original Mainframe code

*QuikJob=bosq003 * * PRINT BUSINESS LICENSE TAPE MASTER FILE * LOAD CLASS CODES FROM PARAM CARDS TO A TABLE OCCURS 100. * WILL SEARCH CLASS TABLE FOR CLASS DESCRIPTION TO PRINT * CLASS TABLE ENTRIES 30 BYTES (CODE 3, FILLER 2, DESCRIPTION 25) * FILE IND DTF=JCS FILE INF DTF=TAPE,BKSZ=8000,RCSZ=100,LFD=BLIC20A

 EQU START-MASTER   INF
 EQU ACCOUNT         (08)
 EQU LICENSEE        (30)
 EQU MAIL-ADD        (25)
 EQU CITY-STATE      (25)
 EQU CLASS-CODE      (03)
 EQU FILLER          (09)
 *
     TABLSPEC 0100 01 03   04 27             /* 100 ENTRIES of 30 bytes
 *
      SET TSA INITIAL                        /* INITIALIZE TABLE POINTER
 *
 1000 GET IND ATEND 2000                  /* READ JCS RECORD
      MOVE IND1-30          TO TSA1-30    /* CLASS CODE & DESCRIPTION
      SET TSA UP 30                       /* ADVANCE TABLE POINTER
      GO TO 1000                          /* LOOP BACK
 *
 2000 GET INF ATEND 9000
      MOVE ACCOUNT           TO PRT01-09
      MOVE LICENSEE          TO PRT11-48
      MOVE CLASS-CODE        TO PRT51-53
      IF CLASS-CODE ONTABLE
         MOVE TBH6-30          TO PRT55-79.
      PRINT
      GO TO 2000.
 9000 GO TO EOJ

Goto:   Begin this document End this document UVSI Home-Page

J2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#7 - Table Load & Lookup - converted to uvcopy

 #*quikjob=bosq003
 #*
 #* print business license tape master file
 #* load class codes from param cards to a table occurs 100.
 #* will search class table for class description to print
 #* class table entries 30 bytes (code 3, filler 2, description 25)
 #*
 was=i2000q32000s2000t100000
 # file ind dtf=jcs
 fili4=${DD_IND},rcs=0080,typ=LST
 # file inf dtf=tape,bksz=8000,rcsz=100,lfd=blic20a
 fili1=${DD_BLIC20A},rcs=0100,typ=RSFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32)
 $start-master    =a0(0)                   # equ start-master inf
 $account         =a0000(08)               # equ account (08)
 $licensee        =a0008(30)               # equ licensee (30)
 $mail-add        =a0038(25)               # equ mail-add (25)
 $city-state      =a0063(25)               # equ city-state (25)
 $class-code      =a0088(03)               # equ class-code (03)
 $filler          =a0091(09)               # equ filler (09)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #    tablspec 0100 01 03   04 27             /* 100 entries of 30 bytes
 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
         mvn    $rt,0                      # set tsa initial /* initialize table pointer
 #*
 tag1000 get    fili4,d0                   # 1000 get ind atend 2000 /* read jcs record
         skp>   tag2000
         mvc    tt0(30),d0(30)             # move ind1-30 to tsa1-30 /* class code & description
         add    $rt,30                     # set tsa up 30 /* advance table pointer
         skp    tag1000                    # goto 1000 /* loop back
 #*
 tag2000 get    fili1,a0                   # 2000 get inf atend 9000
         skp>   tag9000
         mvc    p0(9),$account             # move account to prt01-09
         mvc    p10(38),$licensee          # move licensee to prt11-48
         mvc    p50(3),$class-code         # move class-code to prt51-53
 #
         lokz1  tt0(__),tt0(__),$class-code  <--INSERT length, see next page-->
         skp!   ifb0010
         mvc    p54(25),tt5(25)            # move tbh6-30 to prt55-79.
 ifb0010 putb   filo1,p0                   # ifb0010 print
         skp    tag2000                    # goto 2000.
 #
 tag9000 skp    tageoj                     # 9000 goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

J3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#7 - Table Load & Lookup - Manual Changes & Notes

Please see the sample table load & lookup job listed on the previous page. In this case the only manual change required is to insert the table entry length on the lookup instruction. Before & After as follows:

     lokz1  tt0(__),tt0(__),$class-code  <--- as converted (length) omitted
     lokz1  tt0(30),tt0(30),$class-code  <--- CHANGED, entry length inserted

Enhancements to Table Lookup Jobs

If desired you could insert the table data within the job, rather than load it from a file at job initialization. You might do this if the table data was used only in this 1 job & it was only a few lines. For example you could insert the following code after the file declarations, and then remove the code to load from a file (tag1000 get ... skp tag1000).

 lod=t0(30)
 001  X-----description#1-----X
 002  X-----description#2-----X
 003  X-----description#3-----X
 999      - - - etc - - -
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Or if you do want to load the table from a file, you could reduce the table loading code to 1 line by replacing the tag1000 get ... skp tag1000 with:

rtb fili4,t0(30),t0(30)

Please see the 'rtb' instruction in uvcopy3.doc in volume 2 of UVdoc. Also note there is a 'wtb' instruction to write out tables, which might be used at EOJ, after accumulating totals into a table.

Goto:   Begin this document End this document UVSI Home-Page

K1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#8 - Control Level Report - Original Mainframe code

 *QuikJob=palq735  -
 *
 * OBJECTIVE: PRINT BUSINESS ACCOUNTS TO BE AUDITED
 *
 FILE INF DTF=MIRAM,BKSZ=24576,RCSZ=255,LFD=PALNAME
 *
 ++INCLUDE  PALNAME
 EQU PALNAME-REC     INF1-255        /* NAME-ADDRESS RECORD
 EQU BREAK-LVL-FLG   VAL180          /* BREAK-LEVEL FLAG (1-9,F)
 EQU BREAK-PRT-FLG   VAL181          /* BREAK TOTAL-PRINT FLAG
 EQU PAGE-EJECT-FLG  VAL182          /* BREAK PAGE-EJECT FLAG (ON=E)
 EQU NAME-EOF-FLG    VAL196          /* PALNAME FILE EOF FLAG (ON=E)
 EQU SORT-EOF-FLG    VAL200          /* SORT FILE EOF FLAG (ON=E)
 EQU SORT-REC-CTR    CTA5-8-P 0C     /* TOTAL RECORDS SORTED
 SORT AREA RL255 ON  NAUDTR  NACCT
 TITLE 'PALQ735        BUSINESS PERSONAL PROPERTY ACCOUNTS TO BE AUD'
 TITLE 'ITED        $TIM$'
 *
 REPORT NACCT  (ACCOUNTNO)
        NNAME1 (OWNER NAME)
        NNAME2 (TRADE NAME)
        NBPLOC (LOCATION)
        NAUDST (STATUS)
        NAUDTR (AUDITOR)
 BREAK 1 NAUDTR
 1000 GET  INF  ATEND  2000            /* READ PALNAME-FILE (SEQ BY KEY)
      IF  NAUDST  = C'A'               /* AUDIT STATUS = A?
          RELEASE PALNAME-REC TO SORT. /* RELEASE NAME RECORD TO SORT
      GOTO  1000
 2000 RETURN SORTED INTO PALNAME-REC ATEND 2099. /* RETURN SORT-FILE RECORD
      ACCUM ONE IN A  4 BYTE  CTA.
      CHECKBREAKS ON BREAKS PERFORM 5000 THRU 5099.
      PRINT REPORT.
      GOTO  2000.
 5000 IF  BREAK-LVL-FLG  = C'1'
          MOVE C'E' TO  PAGE-EJECT-FLG
          GOTO  5099.
      IF  BREAK-LVL-FLG  = C'F'
          MOVE  C'TOTAL AUDIT RECORDS PRINTED  =' TO  PRT1
          MOVE  SORT-REC-CTR                      TO  PRT31
          GOTO  5099.
 5099 EXIT

Goto:   Begin this document End this document UVSI Home-Page

K2. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#7 - Control Level Report - converted to uvqrpg

 #*quikjob=palq735  -
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,bksz=24576,rcsz=255,lfd=palname
 fili1=${DD_PALNAME},rcs=0255,typ=RSF
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 #* objective: print business accounts to be audited
 #* - select accounts from palname with audit-status code 'A'
 #* - sort these records on auditor-code & acct-number.
 #*   print the sort-file, begin new page on auditor-code break.
 #* - count sorted records & print total (accounts to be audited).
 #*
 lodc1=qq0(32),palname                     # ++include palname
 lodc1=qq0(32)
 $palname-rec     =a0(255)                 # equ palname-rec inf1-255 /* name-address record
 $upsi-0          =o21(1)                  # equ upsi-0 val22 /* fatal-err flag (on=1)
 $break-lvl-flg   =o179(1)                 # equ break-lvl-flg val180 /* break-level flag (1-9,f)
 $page-eject-flg  =o181(1)                 # equ page-eject-flg val182 /* break page-eject flag (on=e
 $sort-rec-ctr    =a4(4p)                  # equ sort-rec-ctr cta5-8-p 0c /* total records sorted
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #sort area rl255 on  naudtr  nacct
 #
 head8=h8000(66),PALQ735        BUSINESS PERSONAL PROPERTY ACCOUNTS TO BE AUD'
 head8=h8066(66),ITED        $time'
 #*
 #report nacct  (accountno)
 #       nname1 (owner name)
 #       nname2 (trade name)
 #       nbploc (location)
 #       naudst (status)
 #       naudtr (auditor)
 #
 head1s2=h1000(60),'accountno owner-name trade-name location status auditor'
 ref=$nacct,'accountno'
 ref=$nname1,'owner-name'
 ref=$nname2,'trade-name'
 ref=$nbploc,'location'
 ref=$naudst,'status'
 ref=$naudtr,'auditor'
 #
 ctll1=$naudtr,'naudtr'                    # break 1 naudtr
 #
 # continued on the next page -------->

Goto:   Begin this document End this document UVSI Home-Page

 @dtl   nop
 #
 tag1000 get    fili1,a0                   # 1000 get inf atend 2000 /* read palname-file (seq by key
         skp>   tag2000
         cmc    $naudst,c'A'               # if naudst = c'A' /* audit status = a?
         skp!   ifb0010
         sxp    $palname-rec               # release palname-rec to sort. /* release name record to s
 ifb0010 skp    tag1000                    # ifb0010 goto 1000
 #
 tag2000 sxg    $palname-rec               # 2000 return sorted into palname-rec atend 2099. /* retur
         skp>   tag2099
         add    $ca01,onex                 # accum one in a 4 byte cta.
 #acum01=$one,'one'                        # accum one in a 4 byte cta.
 #     checkbreaks on breaks perform 5000 thru 5099.
         putb   filo1,p0                   # print report.
         skp    tag2000                    # goto 2000.
 #
 tag5000 cmc    $break-lvl-flg,c'1'        # 5000 if break-lvl-flg = c'1'
         skp!   ifb0020
         mvc    $page-eject-flg,c'E'       # move c'E' to page-eject-flg
         skp    tag5099                    # goto 5099.
 ifb0020 cmc    $break-lvl-flg,c'F'        # ifb0020 if break-lvl-flg = c'F'
         skp!   ifb0030
         mvc    p0(0029),c'TOTAL AUDIT RECORDS PRINTED ='
         mvc    p30(1),$sort-rec-ctr       # move sort-rec-ctr to prt31
         skp    tag5099                    # goto 5099.
 ifb0030 nop
 tag5099 ret=                              # 5099 exit
 tageoj cls    all
        eoj
 #-----------------------------------------------------------------------

Note that the above code (page 2 of example 7) will be deleted since uvqrpg can provide similar functionality using only the page 1 declarations. A few manual changes are required to allow deleting the procedural code above.

  1. uvqrpg sort requires input 'fili8', outputs to 'filo8', which is then input as 'fili1' (same as for jobs without sorts). See next page--->

  2. sort area rl255 on naudtr nacct - converted to following: sort=255,'205(1),0(9)'

  3. cmc $naudst,c'A' - test for Audit status converted to 'keep' stmt keep=204(1),'A' inserted with 'sort' on next page - look up the 'palname' EQU/$symbol file start(lth)

  4. acum01=$one,'one' - manually converted as shown below & moved to page 1 acum01=1,'count' see next page (inserted after 'ref' stmtns)

  5. mvc $page-eject-flg,c'E' - same effect achieved by: ctll1h1=$naudtr,'naudtr' - inserting option 'h1' for headings on ctl brk

Goto:   Begin this document End this document UVSI Home-Page

K3. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#8 - Control Level Report - uvqrpg AFTER changes

 #*quikjob=palq735  -
 #*
 was=i2000q32000s2000t100000
 # file inf dtf=miram,bksz=24576,rcsz=255,lfd=palname
 fili8=${DD_PALNAME},rcs=0255,typ=ISF   #<#1-- change fili1 to fili8 for SORT
 filo8=tmp/palnames,rcs=255,typ=RSF     #<#1-- insert filo8 sort output to tmp
 fili1=tmp/palnames,rcs=0255,typ=RSF    #<#1-- insert fili1 sort input from tmp
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 #*
 lodc1=qq0(32),palname                     # ++include palname
 #
 #sort area rl255 on  naudtr  nacct
 sort=255,'205(1),0(9)'                 #<#2-- uvqrpg equivalent SORT
 keep=204(1),'A'                        #<#3-- uvqrpg record sort selection
 #
 head8=h8000(66),PALQ735        BUSINESS PERSONAL PROPERTY ACCOUNTS TO BE AUD'
 head8=h8066(66),ITED        $time'
 #*
 #report nacct  (accountno)
 #       nname1 (owner name)
 #       nname2 (trade name)
 #       nbploc (location)
 #       naudst (status)
 #       naudtr (auditor)
 #
 head1s2=h1000(60),'account owner-name trade-name location status auditor count'
 ref=$nacct,'account'
 ref=$nname1,'owner-name'
 ref=$nname2,'trade-name'
 ref=$nbploc,'location'
 ref=$naudst,'status'
 ref=$naudtr,'auditor'
 acum1=1,'count'            #<#4-- insert for count & total
 ctll1h1=$naudtr,'naudtr'   #<#5-- total level 1, option 'h1' for new page
 #
 #         #<-- all remaining code deleted, not required for uvqrpg -->
 #--------------------------------------------------------------------------
 #         #  - the only required changes are marked above & summarized below
 <#1-- uvqrpg SORT expects input from fili8, outputs to filo8
      which is then input to the report via fili1 (as always)
 <#2-- sort=255,'205(1),0(9)'     <-- uvqrpg equivalent SORT
 <#3-- keep=204(1),'A'            <-- uvqrpg record sort selection
 <#4-- acum1=1,'count'            <-- insert for count & total
 <#5-- ctll1h1=$naudtr,'naudtr'   <-- total level 1, option 'h1' for new page

Goto:   Begin this document End this document UVSI Home-Page

L1. Converting Mainframe QuikJobs to uvcopy/uvqrpg

Example#9 - quikjob 'REPORT' Conversion

 ** PALQ017 QuikJob - original mainframe code BEFORE conversions    *
 *                                                                   *
 * OBJECTIVE: PRINT REPORT OF CHANGES TO TRANSFER REFUND DATE        *
 *                                                                   *
 FILE INF TYPE=MIRAM,RCSZ=450,BKSZ=2048,LFD=PALACCT,KEYS=YES,INDXBLK=8
 *
 ++INCLUDE VALEQU
 ++INCLUDE PALACCT
 EQU      START-WST WST
 EQU      OLDDT     (6)
 EQU      ATTX      (6)-P  2C
 TITLE  '$JOBNAM$- PALQ017                             MAINTAIN TRANSFE'
 TITLE  'R REFUND DATE         $IPLDAT$         $TIM$         PAGE $PG$'
 REPORT AACCT     (ACCOUNT NUMBER)
        AITEM     (ITEM)
        ATXYR     (TAX YEAR)
        ATTX      (AMOUNT DUE) 2C
        OLDDT     (OLD DATE,)
        ADTTR     (NEW DATE,)
 0010 GET INF ATEND 9999
      MOVE ZEROES TO ATTX
      ADD  ATTX1  TO ATTX
      ADD  ATTX2  TO ATTX
      IF ATTX LT P'00000000000'
         GO TO 20.
      IF ADTTR GT C'000000'
         MOVE ADTTR  TO OLDDT
         MOVE ZEROES TO ADTTR
         REWRITE INF
         MOVE SPACES TO ADTTR
         PRINT REPORT.
      GO TO 10
 0020 IF ADTTR EQ ZEROES
         MOVE SPACES TO OLDDT
         MOVE MMDDYY TO ADTTR
         REWRITE INF
         PRINT REPORT.
      GO TO 10
 9999 GOTO EOJ

Goto:   Begin this document End this document UVSI Home-Page

L2. QuikJob: Example#9 palq017 --> UVCOPY, BEFORE changes

 ** PALQ017 QuikJob - converted to uvcopy - BEFORE manual changes
 **  - compare to original mainframe, after conversion,& AFTER manual changes
 **  - also see the uvqrpg version & notes re which best ??
 #*                                                                   *
 #* objective: print report of changes to transfer refund date        *
 #*                                                                   *
 was=k2000q32000s2000t100000
 # file inf type=miram,rcsz=450,bksz=2048,lfd=palacct,keys=yes,indxblk=8
 fili1=${DD_PALACCT},rcs=0450,typ=ISFl1
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 #
 lodv3c1=h0(200)
 $jobname $jobid $logname $datetime
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),valequ                      # ++include valequ
 lodc1=qq0(32),palacct                     # ++include palacct
 lodc1=qq0(32)
 $start-wst       =k0(0)                   # equ start-wst wst
 $olddt           =k0000(6)                # equ olddt (6)
 $attx            =k0006(6p)               # equ attx (6)-p 2c
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodv3c1=hh0(200)
 $jobname - PALQ017                             MAINTAIN TRANSFE   R REFUND DATE         $date         $time         page####
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #report aacct     (account number)
 #       aitem     (item)
 #       atxyr     (tax year)
 #       attx      (amount due) 2c
 #       olddt     (old date,)
 #       adttr     (new date,)
 #
 lodv3c1=hh0(200)
 account-number item tax-year amount-due old-date new-date
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         mvc    $account-number,$aacct
         mvc    $item,$aitem
         mvc    $tax-year,$atxyr
         edt    $amount-due,$attx,'zzzz,zzz.99-'
         mvc    $old-date,$olddt
         mvc    $new-date,$adttr
 #########################################################################
 See palq017 @run instructions continued on the next page ---------------->

This is a quikjob 'REPORT' conversion - the 'REPORT' definition above is usually best handled by converting to 'uvqrpg', but the update in place requires 'filr1' (vs fili1) which is only possible with 'uvcopy'.

The 'uvcopy' version will require more manual changes. Please compare this to the AFTER changes listing 2 pages ahead. We will move the 6 'mvc/edt' instructions above to the end & setup as a sub-routine, so we can 'bal' to it from 2 places in the code (see 'PRINT REPORT' on the next page).

Goto:   Begin this document End this document UVSI Home-Page

L3. Example#9 palq017 --> UVCOPY, BEFORE changes (pg 2 of 2)

 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
        wtbe   filo1,h0(200),h0(200)  dump headings to outfile
 #
 tag0010 get    fili1,a0                   # 0010 get inf atend 9999
         skp>   tag9999
 #
         mvc    $attx,$zeros               # move zeroes to attx
         add    $attx,$attx1               # add attx1 to attx
         add    $attx,$attx2               # add attx2 to attx
         cmn    $attx,0                    # if attx lt p'00000000000'
         skp<   tag0020                    # goto 20. <
 #
         cmc    $adttr,c'000000'           # if adttr gt c'000000'
         skp<=  ifb0010
         mvc    $olddt,$adttr              # move adttr to olddt
         mvc    $adttr,$zeros              # move zeroes to adttr
         upd    fili1,a0                   # rewrite inf
         mvc    $adttr,$spaces             # move spaces to adttr
         putb   filo1,p0                   # PRINT REPORT        <-- see below
 ifb0010 skp    tag0010                    # ifb0010 goto 10
 #
 tag0020 cmc    $adttr,$zeros              # 0020 if adttr eq zeroes
         skp!   ifb0020
         mvc    $olddt,$spaces             # move spaces to olddt
         mvc    $adttr,$mmddyy             # move mmddyy to adttr
         upd    fili1,a0                   # rewrite inf
         putb   filo1,p0                   # PRINT REPORT        <-- see below
 ifb0020 skp    tag0010                    # ifb0020 goto 10
 #
 tag9999 skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj
 ###########################################################################

These conversion notes continue from bottom of previous page.

The 'mvc' instructions generated from the quikjob 'REPORT' definition will be moved here & setup as a subroutine, so we can 'bal' to it from the 2 places marked above.

 See the results on the 'AFTER CHANGES' listing 2 pages ahead ---------->

Goto:   Begin this document End this document UVSI Home-Page

L4. QuikJob: Example#9 palq017 --> uvcopy, AFTER changes (pg 1 of 2)

 ## PALQ017 QuikJob - converted to uvcopy - AFTER manual changes
 ##  - compare to original mainframe, after conversion,& BEFORE manual changes
 ##  - also see the uvqrpg version & notes re which best ??
 #*                                                                   *
 #* objective: print report of changes to transfer refund date        *
 #*                                                                   *
 was=k2000q30000s2000t100000
 # file inf type=miram,rcsz=450,bksz=2048,lfd=palacct,keys=yes,indxblk=8
 # fili1=${DD_PALACCT},rcs=0450,typ=ISF   #<-- as generated
 filr1=${DD_PALACCT},rcs=0450,typ=ISF     #<-- CHANGE fili1 to filr1 for update
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 fild7=${RUNLIBS}/qjcs,rcs=80,typ=DIR
 #
 lodv3c1=h0(200)
 $jobname $jobid $logname $datetime
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),valequ                      # ++include valequ
 lodc1=qq0(32),palacct                     # ++include palacct
 lodc1=qq0(32)
 $start-wst       =k0(0)                   # equ start-wst wst
 $olddt           =k0000(6)                # equ olddt (6)
 $attx            =k0006(6p)               # equ attx (6)-p 2c
 #
 # next 6 $symbols added manually (uvcopy conversion of REPORT function)
 $account-number  =p00(9)          #
 $item            =p16(3)          #
 $tax-year        =p21(2)          # <-- $symbols added manually
 $amount-due      =p30(12)         #   - using dsp(lth)'s calculated below
 $old-date        =p44(6)          #   - see 0(9)   16(3) 21(2) etc
 $new-date        =p53(6)          #
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodv3c1=hh0(200)
 $jobname PALQ017  MAINTAIN TRANSFER REFUND DATE  $date $time page####
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #> put TITLE parts together TRANSFE    R  (shift 4 left ??)
 #report aacct     (account number)
 #       aitem     (item)
 #       atxyr     (tax year)
 #       attx      (amount due) 2c
 #       olddt     (old date,)
 #       adttr     (new date,)
 #
 lodv3c1=hh0(200)
 account-number item tax-year amount-due    old-date new-date
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # 0(9)        16(3) 21(2)    30(12)        44(6)    53(6)
 #
 # - uvcopy does not simulate REPORT as well as uvqrpg, but is often best
 # - I suggest you note the field dsplcmnts(& lengths) as shown above
 #   (determine by moving cursor to fieldname & noting CRT column)
 # - then makeup $symbol equates for the 6 fields as shown 15 lines above
 # - then move the 6 mvc/edt generated instrns to wherever 'PRINT REPORT'
 #   occurs within the quikjob (occurred  2x, so we made it a bal subrtn).

Goto:   Begin this document End this document UVSI Home-Page

L5. Example#9 palq017 --> uvcopy, AFTER changes (pg 2 of 2)

 @run
        opn    all                    open files
        clr    t0(100000),'~'         clear table to all tildes
        clr    h400(200),'~'          mark end 2 hdrs 200 each (change if more)
        wtbe   filo1,h0(200),h0(200)  dump headings to outfile
 #
 #tag0010 get    fili1,a0             # 0010 get inf atend 9999 <-- original
 tag0010 redm2  filr1,a0              # 0010 get inf atend 9999 <-- mod for upd
         skp>   tag9999
 #
 #?#     mvc    $attx,$zeros           # move zeroes to attx <-- generated WRONG
         mvn    $attx,0                    # move 0 to attx  <-- NOTE correction
         add    $attx,$attx1               # add attx1 to attx
         add    $attx,$attx2               # add attx2 to attx
         cmn    $attx,0                    # if attx lt p'00000000000'
         skp<   tag0020                    # goto 20. <
 #
         cmc    $adttr,c'000000'           # if adttr gt c'000000'
         skp<=  ifb0010
         mvc    $olddt,$adttr              # move adttr to olddt
         mvc    $adttr,$zeros              # move zeroes to adttr
 #<      upd    fili1,a0                   # rewrite inf         <-- original
         upd    filr1,a0                   # rewrite inf         <-- mod for upd
 # update requires change fili1 to filr1 & get to redm2 (get next)
         mvc    $adttr,$spaces             # move spaces to adttr
         bal    rept                       # PRINT REPORT        <-insert bal
 ifb0010 skp    tag0010                    # ifb0010 goto 10
 #
 tag0020 cmc    $adttr,$zeros              # 0020 if adttr eq zeroes
         skp!   ifb0020
         mvc    $olddt,$spaces             # move spaces to olddt
         mvc    $adttr,$mmddyy             # move mmddyy to adttr
 #<      upd    fili1,a0                   # rewrite inf         <-- original
         upd    filr1,a0                   # rewrite inf
 # update requires change fili1 to filr1 & get to redm2 (get next)
         bal    rept                       # PRINT REPORT        <-insert bal
 ifb0020 skp    tag0010                    # ifb0020 goto 10
 #
 tag9999 skp    tageoj                     # goto eoj
 tageoj cls    all
        eoj
 #-----------------------------------------------------------------
 # rept - subrtn to PRINT REPORT
 #      - instrns generated by converter from REPORT fields
 #      - moved here & bal rept inserted above at 2 places
 #        & original 2 put's reduced to 1 here
 rept    mvc    $account-number,$aacct
         mvc    $item,$aitem
         mvc    $tax-year,$atxyr
         edt    $amount-due,$attx,'zzzz,zzz.99-'
         mvc    $old-date,$olddt
         mvc    $new-date,$adttr
         putb   filo1,p0                   # PRINT REPORT
         ret=

Goto:   Begin this document End this document UVSI Home-Page

M1. QuikJob: Convert Mainframe QuikJobs to uvcopy or uvqrpg

Limitations & Post Conversion Fixups

Conversion percentage depends on the nature of the mainframe quikjob. Some jobs such as file manipulations & simple field listings will convert 100%, but others will require close inspection and manual fixups. In any case the quikjob2 converter will save a lot of keyboarding.

 --------------------- post conversion fixups --------------------------
  1. ** sample file assignments **

 was=i2000q32000s2000t100000
 # file inf dtf=tape,bksz=6328,rcsz=113,lfd=pubmred
 fili1=${DD_PUBMRED},rcs=0113,typ=RSFl1
 # file inc dtf=miram,bksz=8192,rcsz=2048,indxblk=1,lfd=pubrate
 fili3=${DD_PUBRATE},rcs=2048,typ=ISFl1
 # file ofa dtf=miram,bksz=6375,rcsz=255,k1loc=1,k1len=40,indxblk=8
 filo2=${DD_OFA},rcs=0255,typ=ISFl0,isk1=S(L)
 filo1=${DD_PRNTR},rcs=256,typ=LSTt
 1a. Check file typ=___ assignments
     typ=RSFl1 - Record Sequential Fixed, l1=lock option 'read only/input'
     typ=ISFl1 - Indexed Sequential Fixed, l1=lock option 'read only/inpit'
     typ=ISFl0 - Indexed Sequential Fixed, l0=lock option 'exclusive/output'
               - see uvcopy2.doc in volume 2 of UV doc for complete details

There may a few cases where the converter could not determine whether input file is RSF or ISF. Default is RSF, may have to change.

1b. Watch for 'isk1=S(L)', the converter does not convert the output keys. Please note 'k1loc=1,k1len=40' of file OFA/filo2 above. You would change 'isk1=S(L)' to 'isk1=0(40)'. Note that QuikJob key location was 1 relative, but uvcopy is 0 relative.

 # file ofa dtf=miram,bksz=6375,rcsz=255,k1loc=1,k1len=40,indxblk=8
 filo2=${DD_OFA},rcs=0255,typ=ISFl0,isk1=0(40)

Goto:   Begin this document End this document UVSI Home-Page

M2. QuikJob: Post Conversion Fixups (continued)

  1. Check area assignments, you have to increase for record sizes > 1024. (since 1024 is the default size for uvcopy/uvqrpg areas a-p) The converter assigns quikjob file I/O/work/table areas as follows:


     QJfile    UVfile  UVarea sizedefault
     =================================================================
     INF       fili1     a      1024    input file #1
     DET       fili2     b      1024    input file #2
     INC       fili3     c      1024    input file #3
     IND       fili4     d      1024    input file #4
     print     filo1     p      1024    print area
     OFA       filo2     e      1024    output file #1
     OFB       filo3     f      1024    output file #2
     OFC       filo4     g      1024    output file #3
     HDA+   page-hdngs   h      1024    page headings
     WST       work      i      2000    quikjob work area
                        j-n     1024    available for user changes
     VALEQU QJ special   o      1024
     EQU    $symbols     q     32000    allows 1000 $symbols (32 bytes each)
                         r     1024     available to user
     SAV   save area     s     2000     quikjob save area
     TBL     tables      t    100000    table storage
                        u-z    .....    uvcopy/uvqrpg reserved areas
                                        (see uvcopy2.doc in vol 2 of UVdoc)

uvcopy areas are assigned as follows (prior to files, see prior page)


     was=i2000q32000s2000t100000
     ===========================
       # file inc dtf=miram,bksz=8192,rcsz=2048,indxblk=1,lfd=pubrate
       fili3=${DD_PUBRATE},rcs=2048,typ=ISFl1
       So you would have to specify area 'c' as 2048 in the 'was' stmnt:

     was=i2000q32000s2000t100000c2048  <-- area 'c' specified as 2048 bytes
     ================================

Goto:   Begin this document End this document UVSI Home-Page

M3. QuikJob: Post Conversion Fixups (continued)

3. Character fields vs Numeric fields

Watch for 'mvc's (move character) that should be 'mvn's (move numeric) & for 'cmc's (compare character) that should be 'cmn's (compare numeric). If op1 & op2 are different lengths you must change 'mvc' to 'mvn' or 'cmc' to 'cmn'. The converter does not always know the correct type especially if $symbols are used & fields have been unpacked. For example:

 $sale            =a101(5)                #equ sale    (5)
 $tax             =a106(5)                #equ tax     (5)
 $total-sale      =a110(7)                # equ total-sale (007)
         mvc    $total-sale,$sale        # move sale to total-sale
         add    $total-sale,$tax         # add tax   to total-sale
         cmc    $total-sale,c'0010000'   # /* over $ 100.00 ?

The 'mvc' is WRONG because it moves left to right & because uvcopy/uvqrpg do not imply decimal points (the programmer must keep track). For example

 Before mvc: sale=123.45, tax=008.25, total-sale=00000.00
  After mvc: sale=123.45, tax=008.25, total-sale=12345.00
  After add: sale=123.45, tax=008.25, total-sale=12353.25

The mvc length is determined only by the operand 1 length (7 in this case) so the 5 digit sale is moved to 1st 5 bytes of total-sale & then 1st 2 bytes of tax (following field) are moved to the 7 byte total-sale field (in effect multiplying by 100, obviously all wrong).

The solution is to change any such 'mvc's of numeric fields to 'mvn's.

         mvn    $total-sale,$sale        # move sale to total-sale
         add    $total-sale,$tax         # add tax   to total-sale
         cmn    $total-sale,10000        # /* over $ 100.00 ?

'mvn' respects different length operands, in effect moves right to left & zero-fills any extra length on the left side of operand 1.

The original 'cmc' with op2 c'0010000' would work OK, because the quickjob programmer always padded the constant to the same length, but the 'cmn' would be necessary for fields of different lengths.

I recommend you use the vi editor /search command to 'search next' thru all 'mvc's in the program & change to 'mvn' when the operands are numeric. Then 'search next' thru all 'cmc's & change to 'cmn' as required.

This problem is caused by unpacking, both quikjob & uvcopy work OK with packed fields of different lengths, but unpacked fields are not identified as numeric vs character.

Of course you must be careful not to change non-numeric fields or fields that are more than 10 bytes which is the maximum for numeric fields. (will be 16 bytes for UnixWare 7.1.1).

Goto:   Begin this document End this document UVSI Home-Page

M4. QuikJob: Post Conversion Fixups (continued)

3. Character vs Numeric (continued)

Do not change 'mvc's to numeric unpacked fields from '$zeros'. Would be wrong if op1 were packed, would be OK if unpacked, but 'mvn' would cause error message since $zeros is 300 bytes long & numerics are checked for greater than 16 bytes.

       mvc   $attx,$zeros      - $zeros is character, $attx is numeric
                               - this will work if $attx is unpacked numeric
       mvn   $attx,0         <-- this works for packed or unpacked
       mvn   $attx,0         <-- must change to this if $attx is packed

3. Character vs Numeric - more examples

 QJ example:  IF INF21-25 = C'00123'   - QuikJob comparison char/numeric ?
 conversion:  cmc  a20(5),c'00123'     - uvcopy conversion
 correction:  cmn  a20(5),123          - might change 'cmc' to 'cmn' &
                                         char constant to numeric constant
 QJ example:  IF INF31-33 = P'00123'   - Quikjob compare on packed field
 conversion:  cmn  a30(3p),123         - uvcopy conversion OK

There may be some circumstances where character instructions may need to be changed to numeric equivalents (mvc to mvn, cmc to cmn).

The cmc .. c'00123' does not need to be changed - ie character compares will work as long as the fields are same length & both zero filled.

But numeric comparisons are better since the fields do not have to be the same lengths & any constants do not have to be zero filled.

Goto:   Begin this document End this document UVSI Home-Page

M5. QuikJob: Post Conversion Fixups (continued)

4. multiply/divide/rounding

Watch for multiply/divide/rounding with decimal place adjustments. Some fields may not be big enough to hold the results of the multiply inserted prior to divide, which is required to develop extra decimal places &/or for rounding. Consider the following example:

 $usage           =i231(7)     # equ usage
 $days            =i238(3)     # equ days
 $avg             =i241(7)     # equ avg     <-- NOT BIG ENOUGH ???
 $xxx             =i248(5)     # equ xxx

# DIVD USAGE 0D BY DAYS 0D GIVING AVG 4DR. <-- original QuikJob Divide

         mvn    $avg,$usage    # divd usage 0d by days 0d giving avg 4dr
         mpy    $avg,100000    # divd usage 0d by days 0d giving avg 4dr
         div    $avg,$days     # divd usage 0d by days 0d giving avg 4dr
         add    $avg,5
         div    $avg,10

The converter generates 5 instructions: 1. move dividend to result field 2. multiply by 10... to develop decimal places specified in result + extra for rounding (10000 for 4 decimals * 10 for rounding). 3. DIVIDE by the divisor 4. add 5 for rounding 5. divide by 10 to drop the extra decimal place for rounding

 $avg             =i241(7)     # equ avg     <-- NOT BIG ENOUGH ???

It is obvious that we need to increase the size of '$avg' to allow for multiply by 100000, but if we increase in its original p[osition we would have to increase any following fields. Since this is the quikjob/ uvcopy WST/working storage, we can just reassign to a higher position beyond all current WST fields, for example:

 $avg             =i500(12)    # equ avg     <-- reassigned & enlarged

You would have to watch for any divides within a record layout which you cant change. Then you could do the divide in an alternate field & move back after. Would be convenient to use 1 of the uvcopy built-in counters $ca1, $ca2, etc. This would require 1 extra instruction:

         mvn    $ca1,$usage    # divd usage 0d by days 0d giving avg 4dr
         mpy    $ca1,100000    # divd usage 0d by days 0d giving avg 4dr
         div    $ca1,$days     # divd usage 0d by days 0d giving avg 4dr
         add    $ca1,5
         div    $ca1,10
         mvn    $avg,$ca1      # <-- extra instrn, move results back

I recommend you use the vi editor to search for all /mpy instructions & for decimal place expansion prior to divide & modify if required.

Goto:   Begin this document End this document UVSI Home-Page

M6. QuikJob: Post Conversion Fixups (continued)

  1. Fixups for quikjobs converted to UVCOPY. Note the following are unique to uvcopy.

 5a. REWRITE - requires several changes because uvcopy does not allow
               updates to sequential input file 'fili1'
             - but you can change 'fili1' to 'filr1' random file
             - change 'get fili1' to 'redm2 filr1' (read next)
             - change 'upd fili1' (from REWRITE) to 'upd filr1'
             - see example#9 in this document
 5b. REPORT - uvcopy only partially converts
            - generates 'mvc's for the fields where REPORT is specified
            - you must move to 'PRINT REPORT' location in code
            - you also have to setup $symbols for the print fields
              & determine positions from the heading line generated
              (see sample conversion in example#9)
  1. Fixups for quikjobs converted to UVQRPG Note the following are unique to uvqrpg

6a. For uvqrpg, you must remove 'get' instructions for the primary file & any skip back to repeat the instruction loop for each primary record.

 6b. REWRITE - as of June 2000, uvqrpg would not do the job in example#9.
             - because the built in cycle reads from 'fili1' with 'get'
             - we need filr1 with redm2 to allow upd.

Goto:   Begin this document End this document UVSI Home-Page

M7. QuikJob: Post Conversion Fixups (continued)

  1. Convert 'TABLSPEC' & 'CALL TBLSRT' manually, for example:

     # TABLSPEC 1250 01 04   05 26                 <-- info only
         - - - - - - - -
     # CALL TBLSRT TSA1 C'30' C'01' C'04' C'A' C'C'
         srtn1  t0(30),t0(4),5000        <-- uvcopy/uvqrpg equivalent
  1. IF ... ONTABLE & following reference to FUN, example:

       IF  PRT67-70  IS  ONTABLE
           MOVE  FUN1-18 TO PRT72.
       lokz1  tt0(__),tt0(__),p66(4)  <-- converter omits entrylth&keylth
       skp!   01
       mvc    p71(18),tt0(18)         <-- table entry adrs tt0 incorrect
       lokz1  tt0(30),tt0(04),p66(4)  <-- manual fixup entry lth & keylth
       skp!   01
       mvc    p71(18),tt4(18)         <-- manual fix dsplcmnt tt0 to tt4

Goto:   Begin this document End this document UVSI Home-Page

M8. QuikJob: Post Conversion Fixups (continued)

  1. Check areas assigned to addresses covered with registers

      SET  PTA DET21        -->  mvn  $ra,20
      ---
      MOVE PTA1-2 TO PRT41  -->  mvc  p40(2),ba0(2)
                                             |^-----register 'a'
                                             ^------area 'b'

10. SORT AREA requires coding of 'sxo' & 'sxs' instructions

QUikJob: SORT AREA RL75 ON OFA21-26 - will not be converted

convert: # sort area rl75 on ofa21-26 - just #commented out

 correct#1:   sxo  75,'20(6)'           <-- insert uvcopy equivalent at init
 correct#2:   sxs                       <-- also need to insert sort execute
note
  • you will need to research the program & insert the 'sxs' prior
    to the 1st 'RETURN SORTED' record
  • QuikJOb did not need an explicit 'SORT EXECUTE', it was automatically
    performed on the first 'RETURN'
  • See example#4 on page G1/G2/G3.

10b. SORT AREA not converted to uvcopy

SORT FILE was built in to QuikJob and would require more manual coding than SORT AREA (described above). You would have to code 'sxp' (put to sort) & 'sxg' (get from sort), as well as 'sxo' & 'sxs'.

However in some cases, you can completely replace the SORT FILE quikjob with a 1 line 'uvsort' directly in the JCL/script that called the quikjob. uvsort has select/delete capability that might be used in quikjobs. See example#5 on page 'H1'.

Goto:   Begin this document End this document UVSI Home-Page

M9. QuikJob: Post Conversion Fixups (continued)

11. OPEN & CLOSE corrections

Most quikjobs do not explicitly code open & close. The uvcopy converter assumes this & inserts 'opn all' at the begining of the program.

So for those jobs that do code open & close you will have to analyze why & correct accordingly. Open & close are probably used where a program might have had variable number of input tapes or wrote a file which was then read back in , etc.

For example assume a program has opens & closes for the input file but none for the output file, modify as follows:

 converted:   opn   all
              ...
              opn   fili1
              ...
              cls   fili1
              ...
              cls   all
              eoj
 corrected:   opn   filo1           <-- replace 'opn all' with opens only
                                        for files that quikjob did not open
              ---                     - same
              cls   all               - cls all is OK regardless
                                        (only closes files yet unclosed)

12. $symbols with '+' characters embedded

QuikJob: EQU YEAR+1 WST21-24

 convert:  $year+1        =i20(4)
 correct:  $year_1        =i20(4)      <-- remove/change '+'

Goto:   Begin this document End this document UVSI Home-Page

M10. QuikJob: Post Conversion Fixups (continued)

13. Large QuikJobs > 500 lines

For QuikJobs with over 500 lines of instructions (comments dont count) will require the 'rop=j' option to specify a larger instruction area. The 'rop=j' option needs to be inserted prior to the 'was=' (work area sizes) and the file declarations (fili1=..., filo1=..., etc). For example:

rop=j128000
  • to allow about 1000 lines of code
rop=j64000
  • the default allows about 500 lines
    (each instruction requires about 120 bytes)

14. Check for more than 2 Heading Lines

The uvcopy conversion presumes not more than 2 headers (HDA & HDB). An instruction is generated at the begining to ensure the header storage area is terminated after HDA & HDB. For example:

    clr  h400(200),'~'          mark end 2 hdrs 200 each (change if more)

You will need to modify if more than 2 headers are used. For 3 headers:

    clr  h600(200),'~'         <-- mark end table after 3 hdrs (200 each)

This is relevant if the program is building headers in HDA, HDB, HDC, etc & using DOHEADERS to write the headings to the print file.

wtbe filo1,h0(200),h0(200) <-- doheaders converted to wtbe

If the headrs were built via HDRA, HDRB, HDRC, etc declarations then the conversion would have already stored the line of tildes after the last HDR declared.

Goto:   Begin this document End this document UVSI Home-Page

M11. QuikJob: Post Conversion Fixups (continued)

15. CALL to sub-program

Example
  • palq019 called DPS042 (COBOL sub-program) to display
    messages upon console. I am not sure why it was not
    done directly with quikjob, but we can convert as follows:

original quikjob code

      MOVE C'CONSLOG   ' TO DPS042-MODE
      MOVE SPACES TO DPS042-DISPLAY
      MOVE C'PALPAYT READ' TO DPS042-DISPLAY
      CALL DPS042 DPS042-MODE
      MOVE SPACES TO DPS042-DISPLAY
      MOVE PAYT-READ TO DPS042-DISPLAY
      CALL DPS042 DPS042-MODE

as converted by quikjob2

 #-      mvc    a41(10),c'CONSLOG   '
 #-      mvc    a41(1),$spaces
 #-      mvf    a41(0012),c'PALPAYT RECS'
 #-      call dps042 dps042-mode
 #-      mvc    a41(1),$spaces
 #-      mvc    a41(1),$payt-read
 #-      call dps042 dps042-mode

uvcopy code replacement

         mvf    j0(80),'PAL019W RECS  '         #+ format msg in area 'j'
         edt    j14(8),$sort-cnt,'zzz,zz9-'     #+ edit value beside hdng
         msg    j(60)                           # display msg on console

The converter converts 'DPS042-XXX' to a41(1) because DPS042 looks like an area address (like INF21-25, DET31-50, etc). The length is often (1) because the '-XXX' has no numeric value.

We have replaced the 6 MOVEs & 2 CALLs with 3 instructions as shown above. We will show the field-heading & the field-value side by side (vs 2 lines). The MOVE SPACES to clear is unnecessary since the 'mvf' instruction moves the constant & clears the remainder of the 80 byte area.

Note that areas j,k,l,m,n are not used by the quikjob converter & are available for you to use as you see fit.

Also note the convention of showing QUIKJOB lines disabled & uvcopy enabled.

 '#-' - indicates a quikjob conversion line disabled
      - usually in cols 1 & 2 to disable entire line
 '#+' - indicates a uvcopy line inserted
      - usually on the right side of the uvcopy instruction inserted

Goto:   Begin this document End this document UVSI Home-Page

M12. QuikJob: Post Conversion Fixups (continued)

16. PERFORM THRU problems

Watch for 'PERFORM THRU' where thre is an 'EXIT' prior to the line# specified on the THRU line#. Here is a sample of OS3 & uvcopy code:

      PERFORM 5000 THRU 5099.
      ---
 5000 ...
      ...
 5050 EXIT
      ...
 5099 EXIT
         bal  tag5000
         ---
 tag5000 ...
         ...
 tag5050 ret=
         ...
 tag5099 ret=

The converter does not consider the THRU line# (5099 in this case), but returns on the 1st EXIT (tag5050 ret= in this case). I dont think many quikjobs would be coded this way, but you must be aware of the possibility.

Goto:   Begin this document End this document UVSI Home-Page

N1. QuikJob: More Things to Watch Out For

This section will document some more things to 'WATCH OUT FOR', things that dont convert automatically & require inspections & fixups.

VALEQU

QuikJob include a 'VAL' area which stored some useful values which programs could use or test status after certain operations. Here is the VAL area Equates with any uvcopy equivalents noted on the right side.

                                                         uvcopy equivalent
 EQU  UNDLEN  VAL1-4-P     /* LEN.LAST UNDEF REC READ
 EQU  IPLDAT  VAL5-12      /* IPL DATE MM/DD/YY          $date
 EQU  MONTH   VAL13-21     /* MONTH-FULL SPELLING        $longdate
 EQU  UPSI-0  VAL22        /* *0000000
 EQU  UPSI-1  VAL23        /* 0*000000
 EQU  UPSI-2  VAL24        /* 00*00000
 EQU  UPSI-3  VAL25        /* 000*0000
 EQU  UPSI-4  VAL26        /* 0000*000
 EQU  UPSI-5  VAL27        /* 00000*00
 EQU  UPSI-6  VAL28        /* 000000*0
 EQU  UPSI-7  VAL29        /* 0000000*
 EQU  REMNDR  VAL30-37-P   /* DIVIDE REMAINDER           $rem
 EQU  JOBNAM  VAL38-45     /* JOB NAME                   $jobname
 EQU  IOSTAT  VAL46-49     /* IO STATUS-0000=OK,0004=BAD
 EQU  MMYYDD  VAL50-55     /* DATE, IN MMDDYY FMT        $mmddyy
 EQU  MMDDYY  VAL50-55     /* DATE, IN MMDDYY FORMAT     $mmddyy
 EQU  YYMMDD  VAL56-61     /* DATE, IN YYMMDD FORMAT     $yymmdd
 EQU  SYSTIM  VAL62-66     /* TIME, IN HH.MM  FORMAT     $time
 EQU  ABNDCD  VAL67-70     /* ABEND CODE
 EQU  JULDAT  VAL71-75     /* JULIAN DATE YYDDD
 EQU  BRKLVL  VAL180       /* LEVEL NO. PRESENT BREAK
 EQU  PRTSW   VAL181       /* PRINT TOTALS SWITCH
 EQU  EJCTSW  VAL182       /* PAGE EJECT SWITCH
 EQU  INFEOF  VAL196       /* INF END-OF-FILE            ~EOF in area 'a'
 EQU  DETEOF  VAL197       /* DET END-OF-FILE            ~EOF in area 'b'
 EQU  INCEOF  VAL198       /* INC END-OF-FILE            ~EOF in area 'c'
 EQU  INDEOF  VAL199       /* IND END-OF-FILE            ~EOF in area 'd'
 EQU  SRTEOF  VAL200       /* SORT END-OF-FILE
 EQU  RECLEN  VAL201-204   /* REC. LEN (SORT, AREA-V)
 EQU  CALLEN  VAL205-208-B /* LEN. LAST MODULE CALLED
 EQU  RECCNT  VAL209-212-B /* REC COUNT (LAST FILE USED)
 EQU  RECNO   VAL213-216-B /* RELATIVE RECORD NO. (MIRAM)
 EQU  CURKEY  VAL217       /* CURRENT KEY OF REFERENCE
 EQU  DUPS    VAL218-222   /* (DTF ONLY) KEY W/DUPS
 EQU  SCANCT  VAL225-228-B /* SCAN COUNT (WHEN INCLUDE)
 EQU  LSTFIL  VAL229-231   /* NAME OF LAST FILE USED      $fili1,$fili2,etc
 EQU  DTFCDM  VAL232-235-B /* DTF/CDIB MEMORY ADDRESS

Goto:   Begin this document End this document UVSI Home-Page

N2. QuikJob: Code To Watch Out For

UPSI testing & setting

uvcopy & uvqrpg do not store UPSI as did QuikJob, but if the calling script was converted from mainframe JCL by 'jclunix2' (Vancouver utility converter) then you could test the $UPSI environmental variable set by the script. For example you could test UPSI-1 as follows:

      mvfv3  j0(8),'${UPSI}'       store UPSI value in any unused area
      cmc    j1(1),'1'             UPSI-1 on ?
      skp=   xxx

Many quikjobs set UPSI-0 to '1' to indicate an error condition to the calling JCL. They would set UPSI-0 on at begining & off at succesful EOJ and any ABEND would cause UPSI-0 to be still ON if the job abended.

     MOVE '1' to UPSI-0          <-- at begin job
     ABEND                       <-- would mean UPSI-0 ON at EOJ
     MOVE '0' to UPSI-0          <-- at successful End of Job

By convention UNIX scripts test the return code.

    if [ $? -gt 0 ]; then echo "job error, enter to exit"; read; exit 9; fi

The cancel 'can' instruction will set a nonzero return code, whereas the normal 'eoj' instruction sets retun code zero.

UPSI/cancel example

 9998 IF VAL22-24 = C'111'
         GOTO 9999.
      MOVE C'0' TO VAL22
 9999 GO TO EOJ
          END
 tag9998 cmc    o21(3),c'111'              # 9998 if val22-24 = c'111'
         skp=   tag9999                    # goto 9999. =
         mvc    o21(1),c'0'                # move c'0' to val22
 tag9999 skp    tageoj                     # 9999 goto eoj
 tageoj cls    all
        eoj

You might see the above code at the end of a quickjob. The converted quikjob (now uvcopy) does not load UPSI nor pass UPSI back to the JCL, but in this case the quikjob code (prior to eoj code shown) has set the VAL22-24 (UPSI) switches to '111' to signal some error condition. I suggest modifying the code as shown below:

 tag9998 cmc    o21(3),c'111'              # 9998 if val22-24 = c'111'
         skp=   tag9999                    # goto 9999. =
         msg    'error - ?????'      <-- display appropriate error message ?
         can                         <-- cancel to return non-zero to script
 tag9999 skp    tageoj                     # 9999 goto eoj
 tageoj cls    all
        eoj

Goto:   Begin this document End this document UVSI Home-Page

N3. QuikJob: Code To Watch Out For

EOF tests using VALEQU flags

 1000 GET INF
      IF INFEOF EQ C'E'
         GO TO 9000.
 tag1000 get    fili1,a0                   # 0035 get inf
         skp>   tag0000
         cmc    $infeof,c'E'               # if infeof eq c'E'
         skp=   tag9000                    # goto 9000

The above code wont work since uvcopy does not store '$infeof' in VALEQU. Most quikjobs use the 'ATEND' test which does convert correctly for example:

 1000 GET INF ATEND 9000.
 tag1000 get    fili1,a0                   # 1000 get inf atend 9000.
         skp>   tag9000

So you can simply change the 4 instructions from conversion to the 2 instructions that would be created by the ATEND version.

quikjob VALEQU = uvcopy area 'o'

References to the 'VAL' area will be converted to area 'o', for example:

       IF VAL196 = C'E'
          GOTO 9000.
         cmc    o195(1),c'E'               # if val196 = c'E'
         skp=   tag9000                    # goto 9000. =

If you needed a delayed test for EOF vs testing condition code immediately (as shown above in the ATEND conversion), then you could test the file area for '~EOF' in 1st 4 bytes, for example:

         cmc    a0(4),'~EOF'
         skp=   tag9000

Goto:   Begin this document End this document UVSI Home-Page

N4. QuikJob: Code To Watch Out For

EOF tests in PERFORMs (subrtns)

 1000 PERFORM 5000 THRU 5099
      IF INFEOF EQ C'E'
      GOTO 1500
      --------------
 5000 GET INF
      EXIT

converted code BEFORE changes

 tag1000 bal    tag5000
         cmc    $infeof,c'E'               # if infeof eq c'E'
         skp=   ifb1500
         ------------
 tag5000 get    fili1,a0                   # 0035 get inf
         skp>   tag0000
         ret=

converted code AFTER changes

 tag1000 bal    tag5000
         cmc    $infeof,c'E'               # if infeof eq c'E'
         skp=   ifb1500
         ------------
 tag5000 get    fili1,a0                   # 0035 get inf
         skp=   tag5099                    #+ go exit if cc = (not EOF)
         mvc    $infeof,c'E'               #+ set EOF switch
 tag5099 ret=

This is the best solution because you only need to modify the subrtn & not the perform/bals (could be multiple). Note that '#+' marks the only lines needing changes.

Goto:   Begin this document End this document UVSI Home-Page

N5. QuikJob: Code To Watch Out For

I/O STATUS test using VALEQU/IOSTAT

      READKEY DET USING INF1
      IF IOSTAT EQ C'0004'
         MOVE C'NO PALNAME RECORD FOUND' TO SNAME1.
         redm5  fili2,b0                   # readkey det using inf1
         skp=   tag____
         cmc    $iostat,c'0004'            # if iostat eq c'0004'
         skp!   1
         mvc    $sname1,c'NO PALNAME RECORD FOUND'

uvcopy sets the condition code to indicate the I/O STATUS, so in this case just remove 2 instructions (cmc & skp!) and change the tag____ to ifb0010.

         redm5  fili2,b0                   # readkey det using inf1
         skp=   ifb0010
         mvc    $sname1,c'NO PALNAME RECORD FOUND'
 ifb0010 nop

Goto:   Begin this document End this document UVSI Home-Page

N6. QuikJob: Code To Watch Out For

I/O status tests in PERFORM (subrtns)

      PERFORM 5000
      IF IOSTAT EQ C'0004'
         MOVE C'NO PALNAME RECORD FOUND' TO SNAME1.
       ---------------------
 5000 READKEY DET USING INF1
      EXIT

converted code BEFORE changes

         bal    tag5000
         cmc    $iostat,c'0004'            # if iostat eq c'0004'
         skp!   1
         mvc    $sname1,c'NO PALNAME RECORD FOUND'
         -------------------
 tag5000 redm5  fili2,b0                   # readkey det using inf1
         skp=   tag____
         ret=

converted code AFTER changes

         bal    tag5000
         cmc    $iostat,c'0004'            # if iostat eq c'0004'
         skp!   1
         mvc    $sname1,c'NO PALNAME RECORD FOUND'
         -------------------
 tag5000 mvc    $iostat,c'0000'            #+ presume I/O stat good
         redm5  fili2,b0                   # readkey det using inf1
         skp=   tag5099                    #+ skip if cc = (I/O good)
         mvc    $iostat,c'0004'            #+ set I/O stat BAD
 tag5099 ret=

This is the best solution because you only need to modify the subrtn & not the perform/bals (could be multiple). Note that '#+' marks the only lines needing changes.

Goto:   Begin this document End this document UVSI Home-Page

N7. QuikJob: Code To Watch Out For

FILE conversions

You should check the FILE conversions, since there are some situations that can not be converted automatically. Note that the original Mainframe FILE code is shown as a #comment before the converted equivalent:

# file#1 inf dtf=miram,bksz=4224,rcsz=127,keys=yes,lfd=pal671w fili1=${DD_PAL671W},rcs=0127,typ=ISFl1 # # file#2 det dtf=miram,bksz=8000,rcsz=80,lfd=pal672w fili2=${DD_PAL672W},rcs=0080,typ=RSF # # file#3 inc dtf=miram,bksz=1000,rcsz=100,keys=no,lfd=pal673w fili2=${DD_PAL673W},rcs=0100,typ=RSFl1 # # file#4 ofa dtf=miram,bksz=4224,rcsz=127,lfd=pal674w,keys=yes,k1loc=1,k1len=9 filo2=${DD_PAL674W},rcs=0127,typ=ISF,isk1=S(L)

file#1
  • converts correctly, 'keys=yes' indicates 'typ=ISF'. Note that for
    input files, we dont need to specify key locations & lengths.
file#2
  • 'typ=RSF' might have to change to 'typ=ISF' because the converter
    could not determine whether it is Indexed or not ?
file#3
  • is coded 'typ=RSF' since 'keys=no', but this could be wrong since
    the mainframe could read the data partition of an indexed file
    sequentially (disregarding the keys). This is a problem for Micro
    Focus indexed files since the record length is 1 greater for ISAM.
    You could add 1 to the rcsz, but it is better to specify 'typ=ISF'
    if the file is actually indexed but was being read sequentially.
file#4
  • 'isk1=S(L)' must be changed, in thisc ase to 'isk1=0(9)'.
  • the converter does not do this automatically.
  • you must also add any other keys (k2loc/k2len, etc)

Notes re unpacked files

If you are unpacking files with packed fields, you must check for possible changes in record sizes & key locations. Input Indexed files may still work but Sequential files & all output files must be updated to new rcszs & keys.

Goto:   Begin this document End this document UVSI Home-Page

N8. QuikJob: Code To Watch Out For

Watch for references to fieldnames in preceding ++INCLUDE copybooks. For example PUBQWATS copybook defines the 'W-ADDRESS' field which occurs 450 bytes up in the record layout, but this is not known to the converter so it converts the displacement as '0000'.

 EQU PUBQWATS     WST
 ++INCLUDE PUBQWATS
 *** REDEFINITION OF ADDRESS FIELD IN PUBWATS ***
         EQU W-ADDRESS
         EQU W-HOUSE           (006)
         EQU W-STREET          (016)

converted code BEFORE changes

 lodc1=qq0(32)
 $pubqwats        =i0(0)               # equ pubqwats wst
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),pubqwats                # ++include pubqwats
 #******* redefinition of address field in pubwats  *******
 lodc1=qq0(32)
 $w-filler        =i0000(0)            # equ ws-filler        <-- WRONG
 $w-house         =i0000(006)          # equ w-house (006)    <-- WRONG
 $w-street        =i0006(016)          # equ w-street (016)   <-- WRONG

converted code AFTER changes

 lodc1=qq0(32)
 $pubqwats        =i0(0)               # equ pubqwats wst
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 lodc1=qq0(32),pubqwats                # ++include pubqwats
 #******* redefinition of address field in pubwats  *******
 lodc1=qq0(32)
 $w-filler        =i0450(0)            #+ equ ws-filler       <-- corrected
 $w-house         =i0450(006)          #+ equ w-house (006)   <-- corrected
 $w-street        =i0456(016)          #+ equ w-street (016)  <-- corrected

You need to examine the 'pubqwats' copybook (qjcs/pubqwats) to see what the true displacement of the 'w-filler' symbol, which in this case was:

 $w-filler        =i0450(0)            #+ equ ws-filler

You can then modify the displacments of any following definitions as shown above.

You might check any displacement '0000' but there are many legitimate '0000' displacements.

Goto:   Begin this document End this document UVSI Home-Page

O1. Search Patterns to find & fix quikjob conversion problems

Here is an easier way to find quikjob conversion problems - use the editor to search for patterns that represent incomplete conversions.


 a. /tag0000    <-- search for missing EOF tests
    ========

    /tag____    <-- also search for this
    ========
    QJ example:  GET INF              - vs GET INF ATEND 9000
    conversion:  get   fili1,a0
                 skp>  tag0000        - tag0000 generated when no ATEND
    correction:  get   fili1,a0
                 skp>  tag_____       <-- need to research
                                          or use VALEQU correction below

 b. /val[0-9]   - search for refernces to VALEQU (not converted)
    =========
    QJ example:  IF VAL196 = C'E'     - test EOF on INF file
    conversion:  cmc  o195(1),c'E'    - VALEQU converted to area 'o'
                                        but area 'o' not stored by uvcopy

correction: cmc a0(4),'~EOF' - uvcopy stores '~EOF' in record area


 c. /(1)       - search for incorrect field lengths
    ====       - converter uses (1) when length cannot be determined
                 so any (1) lengths are suspicious & need to be checked

QJ example: MOVE REC-COUNT TO PRT61 - length will not be determined

conversion: mvc p60(1),$rec-count - (1) used when length unknown

correction: mvc p60(5),$rec-count - research $symbols to find length

Goto:   Begin this document End this document UVSI Home-Page

O2. Search Patterns to find & fix quikjob conversion problems


 d1. /mvc          <-- check all 'mvc's, change to 'mvn' if numeric
     ====

 d2. /cmc          <-- check all 'cmc's, change to 'cvn' if numeric
     ====

Watch for 'mvc's (move character) that should be 'mvn's (move numeric) & 'cmc's (compare character) that should be 'cmn's (compare numeric). If op1 & op2 are different lengths you must change 'mvc' to 'mvn' or 'cmc' to 'cmn'. The converter does not always know the correct type especially if $symbols are used & fields have been unpacked.

     <------- please see the full explanation & examples on page 'M3'.

 e. /mpy         <-- check multiply for extra decimals before divide
    ====

Watch for multiply/divide/rounding with decimal place adjustments. Some fields may not be big enough to hold the results of the multiply inserted prior to divide, which is required to develop extra decimal places &/or for rounding. Consider the following example:

 $usage           =i231(7)     # equ usage
 $days            =i238(3)     # equ days
 $avg             =i241(7)     # equ avg     <-- NOT BIG ENOUGH ???
 $xxx             =i248(5)     # equ xxx

# DIVD USAGE 0D BY DAYS 0D GIVING AVG 4DR. <-- original QuikJob Divide

         mvn    $avg,$usage    # divd usage 0d by days 0d giving avg 4dr
         mpy    $avg,100000    # divd usage 0d by days 0d giving avg 4dr
         div    $avg,$days     # divd usage 0d by days 0d giving avg 4dr
         add    $avg,5
         div    $avg,10
Note
  • see the complete description of this problem & the solution
    described in item #4 on page 'M5' of this document.

Goto:   Begin this document End this document UVSI Home-Page

O3. Search Patterns to find & fix quikjob conversion problems


 f1. /c\'&       - search for &symbols (global substitutions) set in JCL
     =====

QJ example: MOVE C'&TITLE' TO PRT51 - &symbols set in JCL

    conversion:  mvc   p50(6),C'&TITLE'    - & needs conversion to ${...}
                                          - length also needs correction

correction: mvfv2 p50(20),C'${TITLE}' - research print layout for length

f2. Here is another example of the '&symbol' problem that requires an extra instruction - when the substitution value is smaller than the ${...} symbol & there is no extra room available. In this case use a 3rd area for ther extra length (area j below) & then move the substitution value back to the intended area. &CODE is only 1 byte & we cannot destroy any following bytes.

QJ example: MOVE C'&CODE' TO WST1 - capture 1 byte code

conversion: mvc i0(1),C'&CODE' - original conversion

    correction:  mvfv2 j0(7),'${CODE}'   - use area j for required length
                 mvc   i0(1),j0          - then move value to 1 byte code

Goto:   Begin this document End this document UVSI Home-Page

O4. Search Patterns to find & fix quikjob conversion problems

g. Use the vi editor to search converted quikjobs for the following patterns:


    /spaces     - ensure receiving field < 300 bytes
    =======

    /zeros      - ensure receiving field < 300 bytes
    =======     - also check receiving field, if packed you must change
                       mvc   $xxx,$zeros      <-- OK if $xxx unpacked
                       mvn   $xxx,0           <-- use this if packed

    /hivalues   - ensure receiving field < 64 bytes
    =========

    /lovalues   - ensure receiving field < 64 bytes
    =========

QJ example: MOVE SPACES TO OFA1-512 - clearing 512 byte record

    conversion:  mvc  e0(512),$spaces      - uvcopy/uvqrpg conversion
    correction:  clr  e0(512),' '     <-- change 'mvc' to 'clr' with 1 byte
                                        - clear any length to all op2 char

Goto:   Begin this document End this document UVSI Home-Page

O5. Search Patterns to find & fix quikjob conversion problems


 h. /lodc1                        - search for lines such as:
    ======
     lodc1=qq0(32),pubqbase       - modify as follows:
     lodc1=qq0(32),pubqbase,a     - modify as follows:
                           ^^     - note addition of ',a' area

You must add the area code on 'lodc1' references to a quikjob copybook, since the same QJ copybook could be used in different files in different quikjob programs. You can easily determine which area by examining the file declarations, for example:

INF --> fili1 --> area 'a' DET --> fili2 --> area 'b' INC --> fili3 --> area 'c' IND --> fili4 --> area 'd'


 i1. /sort area         <-- search for SORT AREA (RELEASE/RETURN)
     ==========

You must insert 'sxo' (sort open) & 'sxs' (execute sort). See example#4 & changes explained on pages 'G3' & 'G4'.


 i2. /sort file         <-- search for SORT FILE
     ==========

See example#5 on page 'H1'. You may be able to convert to 'uvsort' in the jcl/script & eliminate the quikjob ??.

Goto:   Begin this document End this document UVSI Home-Page

O6. Search Patterns to find & fix quikjob conversion problems


 j. /lfd=&     - search for LFD variable names on FILE statements
    ======

LFD &variable names on FILE stmnts need to be replaced with actuals

sample FILE stmnts with LFD=&variables

 # file inf dtf=tape,bksz=6328,rcsz=113,lfd=&tpubq159b
 fili1=${DD_&TPUBQ159B},rcs=0113,typ=RSFl1
 # file inc dtf=miram,bksz=6350,rcsz=127,indxblk=1,lfd=pubrate
 fili3=${DD_PUBRATE},rcs=0127,typ=ISFl1
 # file ofa dtf=miram,bksz=6400,rcsz=113,keys=no,rcb=no,lfd=&pubq159a
 filo2=${DD_&PUBQ159A},rcs=0113,typ=RSFl0
 filo1=${DD_PRNTR},rcs=256,typ=LSTt

You will need to examine the JCL that calls this QuikJob to determine what the LFD names are. To find the job you could use grep, for example:

 grep PUBQ159 jcl7/*       <-- find jcl calling pubq159
                             - in jcl subdir BEFORE $symbols replaced
 grep PUBQ159 jcl8/*       <-- find jcl calling pubq159
                             - in jcl subdir AFTER $symbols replaced

relevant lines from jcl7/pubj100 (BEFORE $symbols replaced)

 if [ "$TPUBQ159B" = "" ]; then TPUBQ159B="PUBMRED"; fi
 if [ "$PUBQ159A" = "" ]; then PUBQ159A="PUB159A"; fi
              ....................
 export DD_PUBRATE=$DM/ipubrate
 export DD_$TPUBQ159B=$DT/$TPUBQ159B
 export DD_$PUBQ159A=$DW/$PUBQ159A
 export DD_PRNTR=$DP/${PROGID}_${FPUBQ159B}_$(date +%H%M%S)
 logmsg "step# $stp pubq159 begun"
 uvcopy pubq159

relevant lines from jcl8/pubj100 (AFTER $symbols replaced)

export DD_PUBRATE=$DM/ipubrate export DD_PUBMRED=$DT/pubmred export DD_PUB159A=$DW/pub159a export DD_PRNTR=$DP/${PROGID}_STAND1_$(date +%H%M%S) logmsg "step# $stp pubq159 begun" uvcopy pubq159

2 files BEFORE correction

 fili1=${DD_&TPUBQ159B},rcs=0113,typ=RSFl1
 filo2=${DD_&PUBQ159A},rcs=0113,typ=RSFl0

2 files AFTER correction

 fili1=${DD_PUBMRED},rcs=0113,typ=RSFl1
 filo2=${DD_PUB159A},rcs=0113,typ=RSFl0

Goto:   Begin this document End this document UVSI Home-Page

O7. Search Patterns to find & fix quikjob conversion problems


 k. /isk1=S(L)     <-- search for key definitions on indexed output files
    ==========

Not converted automatically, you have to do manually, for example:

    # file ofa bksz=4224,rcsz=127,lfd=pal674w,keys=yes,k1loc=1,k1len=9
    filo2=${DD_OFA},rcs=0127,typ=ISFl1,isk1=S(L)   <-- change this
    filo2=${DD_OFA},rcs=0127,typ=ISFl1,isk1=0(9)   <-- to this

 l. /???????             <-- any other patterns you find useful ??
    ========

Goto:   Begin this document End this document UVSI Home-Page

P1. QuikJob Code Reduction (more work with less code)

There are some situations where you can replace the quikjob converted code with alternative uvcopy code that is much shorter.

Code Reduction #1 - replacing multiple 'IF's with 1 'tst'

Example 1a
  • testing 1 byte code for multiple values:
       IF INF1 = C'A' OR           <-- original mainframe QuikJob code
       IF INF1 = C'B' OR
       IF INF1 = C'C'
          GOTO 1500.
         cmc    a0(1),c'A'         <-- converted to uvcopy
         skp=   ifa0010
         cmc    a0(1),c'B'
         skp=   ifa0010
         cmc    a0(1),c'C'
         skp!   ifb0020
 ifa0010 skp    tag1500
 ifb0020 nop
       tst    a0(1),'ABC'          <-- uvcopy equivalent (manual change)
       skp=   tag1500
Example 1b
  • testing 2 byte codes for multiple values:
       IF INF61 = C'NY' OR          <-- original mainframe QuikJob code
       IF INF61 = C'NJ' OR
       IF INF61 = C'VA'
          GOTO 1500.
       tstl2  a0(1),'NYNJVA'        <-- uvcopy equivalent (manual change)
       skp=   tag1500

The 'tst' instruction assumes multiple 1 byte values, unless you code the 'l' option to specify how long each subfield is ('l2' for 2 bytes). See full description of the 'tst' in uvcopy3.doc in volume 2 of UVdoc.

Goto:   Begin this document End this document UVSI Home-Page

P2. QuikJob Code Reduction (more work with less code)

Code Reduction #2 - using tables to reduce code

Example 2
  • assume we wanted to expand state code to state description
         IF INF61-62 = C'NY'
            MOVE C'NEW YORK' TO STATE-DES.
         IF INF61-62 = C'NJ'
            MOVE C'NEW JERSEY' TO STATE-DES.
         IF INF61-62 = C'VA'
            MOVE C'VIRGINIA' TO STATE-DES.
         cmc    a60(2),c'NY'               # if inf61-62 = c'NY'
         skp!   ifb0010
         mvc    $state-des,c'NEW YORK'     # move c'NEW YORK' to state-des.
 ifb0010 cmc    a60(2),c'NJ'               # ifb0010 if inf61-62 = c'NJ'
         skp!   ifb0020
         mvc    $state-des,c'NEW JERSEY'   # move c'NEW JERSEY' to state-des.
 ifb0020 cmc    a60(2),c'VA'               # ifb0020 if inf61-62 = c'VA'
         skp!   ifb0030
         mvc    $state-des,c'VIRGINIA'     # move c'VIRGINIA' to state-des.
 ifb0030 nop

alternative solution using a table

 lod=k0(20)                   <-- lod a table up front
 NY NEW YORK
 NJ NEW JERSEY
 VA VIRGINIA
 ~~~~~~~~~~~~~~~~~~~~
         lok    k0(20),k0(20),a60(2)    <-- lookup the table
         skp!   1
         mvc    $state-des,kx3

You can see the full description of the 'lod' & 'lok' instructions in uvcopy3.doc in volume 2 of UVdoc, but briefly:

'lok' looks up a table stored previously. The entry length must match on lod & lok. Op1 & op2 'k0(20)' are the same in this case, but op2 allows you to look up multi-column tables.

The search argument 'a60(2)' in this case specifies the compare length, (the 1st 2 bytes of each 20 byte table entry).

When a match is found, the condition code is set '=' and register 'x' points to the matching entry in the table. If the state were 'VA' register 'x' would be '40', and 'kx3' would then address byte 43 in the table. The '3' bypasses bytes 0,1,2 'VA ' to address 1st byte of VIRGINIA. We left a blank between state code & description for aesthetics.

Goto:   Begin this document End this document UVSI Home-Page

P3. QuikJob Code Reduction (more work with less code)

Code Reduction #3 - using tables to reduce code

SCANNING fields for variable data

In the previous example the state was in a known fixed location. In this example the state could be anywhere in the address3 field.

        WHEN	ADRS3 INCLUDES 'NY'             <-- original quikjob code
            MOVE C'NEW YORK' TO STATE-DES.
        WHEN	ADRS3 INCLUDES 'NJ'
            MOVE C'NEW JERSEY' TO STATE-DES.
        WHEN	ADRS3 INCLUDES 'VA'
            MOVE C'VIRGINIA' TO STATE-DES.

alternative solution using a table

 lod=k0(40)                              <-- lod a table up front
  NY ~~~~~~~~~~~~~~~~NEW YORK
  NJ ~~~~~~~~~~~~~~~~NEW JERSEY
  VA ~~~~~~~~~~~~~~~~VIRGINIA
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sct    $adrs3,k0(40),k0(20)       <-- scan adrs3 for table match
        skp!   1
        mvc    $state-des,ky20

The table entries are made 40 bytes just to conform to example#4.

The 1st '~' on each entry marks the end of the search pattern. We leave a blank before & after the 2 byte state code, so we wont match 2 characters within a longer word.

Register 'y' will point to the matching table entry, so 'ky20' will address the right side of the matching 40 byte entry.

Goto:   Begin this document End this document UVSI Home-Page

P4. QuikJob Code Reduction (more work with less code)

Code Reduction #4 - using tables to reduce code

SCAN/REPLACE

Here is an example that can not be done with mainframe quikjob.

Required
  • search adrs3 field for a 2 byte state code & replace with the
    state description.
 lod=k0(40)
  NY ~~~~~~~~~~~~~~~~ NEW YORK ~~~~~~~~~~
  NJ ~~~~~~~~~~~~~~~~ NEW JERSEY ~~~~~~~~
  VA ~~~~~~~~~~~~~~~~ VIRGINIA ~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        rpt    $adrs3,k0(40),k0(20)     <-- search/replace state/description
        ===========================

Table entries are 40 bytes, 20 max search pattern, 20 max replacement. In this case the search patterns are all 4 bytes but they could be variable as are the replacement patterns.

The end of the search pattern & replace pattern is marked by 1st tilde.

The 'rpt' (replace by table) instruction replaces if it finds a match & does nothing if there is no match. If you wanted to know whether a match occurred, you could test the condition code.

        rpt    $adrs3,k0(40),k0(20)
        skp=   match                        <-- test if replacement made

Goto:   Begin this document End this document UVSI Home-Page

Q1. QuikJob: Debugging/Animating QuikJob uvcopy/uvqrpg code

Debugging/Animating QuikJobs

There is a debug facility for QuikJobs (converted to uvcopy/uvqrpg) which is somewhat similar to the Micro Focus COBOL Animator. You can step through the program & display desired areas. You can turn on debugging by exporting a variable, which means you dont have to modify the uvcopy code or the JCL.


 export UVQRPGROP=d        <-- turn on debugging for uvcopy/uvqrpg
 ===================
 export UVQRPGROP=""       <-- turn off debugiing

Here is a sample debugging session using the 'palq671' quikjob listed on page 'D2' of this QuikJob.doc. Here is what you would see if there were only 1 record in the file & you kept pressing enter to execute the next instruction.

 debug>         opn.. all
 debug>         clr.. t0(100000),'~'
 debug>         clr.. h400(200),'~'
 debug>         wtb..e filo1,h0(200),h0(20
 debug> tag1000 get.. fili1,a0
 debug>         skp>. tag9999
 debug>         mvc.. $p-title,$e-title
 debug>         mvc.. $p-state-lic,$e-stat
 debug>         mvc.. $p-acct-num,$e-acct-
 debug>         mvc.. $p-mail1,$e-mail1
 debug>         mvc.. $p-mail2,$e-mail2
 debug>         put..b filo1,p0            <-- see display below
 debug>         skp.. tag1000
 debug> tag1000 get.. fili1,a0             <-- return to read record#2
 debug>         skp>. tag9999
 debug> tag9999 skp.. tageoj
 debug> tageoj  cls.. all
 debug>         eoj..

Note that at any point, you can display any area from any displacement. For example if you displayed area a & area p at the 'put' instruction:


 debug> d a0         <-- display area 'a' (1st 60 bytes)
        ====

 debug> d a60        <-- display area 'a' (bytes 61-120)
        =====

Goto:   Begin this document End this document UVSI Home-Page

Visitor Counters for ThisYear and LastYear