home *** CD-ROM | disk | FTP | other *** search
/ ftp.robelle3000.ai 2014 / 2014.06.ftp.robelle3000.ai.tar / ftp.robelle3000.ai / manuals / text / qcopy.txt < prev    next >
Text File  |  2007-12-20  |  98KB  |  2,551 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                                             _____ _______ ___
  19.                                                             QCOPY Version 4.7
  20.  
  21.  
  22.  
  23.  
  24.                                                           ___________ _______
  25.                                                           Contributed Program
  26.                                                 __ ____ ___ _____ _____ _____
  27.                                                 to Read and Write Qedit Files
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                                                             _____ ____ ______
  38.                                                             Qcopy User Manual
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.                                             _______ _________ __________ ____
  50.                                             Robelle Solutions Technology Inc.
  51.                                                    _____ ____ __________ ____
  52.                                                    Suite 201, 15399-102A Ave.
  53.                                                  _______ ____  ______ ___ ___
  54.                                                  Surrey, B.C.  Canada V3R 7K1
  55.  
  56.                                                     __________  _____________
  57.                                                     Toll-free:  1.888.robelle
  58.                                                              ________________
  59.                                                              (1.888.762.3553)
  60.                                                          ______  ____________
  61.                                                          Phone:  604.501.2001
  62.                                                            ____  ____________
  63.                                                            Fax:  604.501.2003
  64.  
  65.                                                           ___________________
  66.                                                           support@robelle.com
  67.                                                               _______________
  68.                                                               www.robelle.com
  69.  
  70.  
  71.                                                                 ________ ____
  72.                                                                 February 1998
  73.  
  74.  
  75.  
  76.            Program and Manual Copyright  Robelle  Solutions  Technology  Inc.
  77.            1980-2007
  78.  
  79.  
  80.                                                                       ___
  81.            Permission  is  granted  to  reprint  this  document  (but not for
  82.            profit), provided that copyright notice is given.
  83.  
  84.  
  85.  
  86.  
  87.            QEDIT and SUPRTOOL are trademarks of Robelle Solutions  Technology
  88.            Inc.   Other product and company names mentioned herein may be the
  89.            trademarks of their respective owners.
  90.  
  91.                                                                             1
  92.  
  93.  
  94.  
  95.  
  96.     _______ _   _______ __ _____
  97.     Chapter 1   Welcome to Qcopy
  98.  
  99.  
  100.                 _  ___ ________ __ _____
  101.                 *  New Features of Qcopy
  102.                 _  ________ __ _____
  103.                 *  Overview of Qcopy
  104.                 _  ___ __ ___ _____
  105.                 *  How to Run Qcopy
  106.                 _  __________ _____
  107.                 *  Suspending Qcopy
  108.  
  109.  
  110.            Qcopy 4.7 is a contributed program that  reads  and  writes  Qedit
  111.            files.   Qedit  is  a  high  performance,  full-screen text editor
  112.            available from Robelle Solutions Technology Inc.  for  all  models
  113.            of  the  HP e3000 computer system.  Qedit files exist in a special
  114.            compressed format which can only be read by Qedit or software such
  115.            as  Qcopy  that  has been modified to read them.  Qcopy is used to
  116.            convert files to and from Qedit's special format.
  117.  
  118.            Along  with  Qcopy  we  provide  a   stand-alone   routine   named
  119.            Qeditaccess that provides the actual decoding of Qedit files.  You
  120.            may merge this routine into your own programs if  you  wish.   See
  121.            below  for  details.   The code is available in both compatibility
  122.            -mode and native-mode formats.
  123.  
  124.            Qcopy  is  also  used  to  recover  Qedit  files  that  have  been
  125.            corrupted.   While  this happens rarely, Qcopy is the only program
  126.            that can recover the lines of a Qedit file.
  127.  
  128.  
  129.     ___ ________ __ _______ ___ _________ ______
  130.     New Features in Version 4.7 (November 2003):
  131.  
  132.  
  133.            *  Qcopy and Qaccess now  support  the  TrailingSpaces  option  in
  134.               Qedit workfiles.
  135.  
  136.  
  137.  
  138.     ___ ________ __ _______ ___ ________ ______
  139.     New Features in Version 4.6 (October 2002):
  140.  
  141.  
  142.            *  Qeditaccess  can  read  TEXT  files  with  lines of up to 8,172
  143.               characters wide.  If the file  is  wider,  Qeditaccess  returns
  144.               only the first 8,172 characters and ignores the rest.
  145.  
  146.               Qedit  workfiles  are  limited  1,000  characters  i.e.   Jumbo
  147.               workfiles.
  148.  
  149.               Trying to access wide-jumbo workfiles now returns an error:
  150.  
  151.                  -9 for "Qaccess: Wide jumbo workfiles not supported yet."
  152.  
  153.            _______ _   _______ __ _____
  154.     2      Chapter 1   Welcome to Qcopy
  155.  
  156.  
  157.  
  158.     ___ ________ __ _______ ___ _________ ______
  159.     New Features in Version 4.5 (February 1998):
  160.  
  161.  
  162.            *  Qeditaccess no longer misses the last  few  lines  in  a  Jumbo
  163.               file.
  164.  
  165.  
  166.     ___ ________ __ _______ ___ ________ ______
  167.     New Features in Version 4.4 (January 1997):
  168.  
  169.  
  170.            *  Fixed Qeditaccess bug in exceeding record sizes.
  171.  
  172.  
  173.     ___ ________ __ _______ ___ __________ ______
  174.     New Features in Version 4.3 (September 1995):
  175.  
  176.  
  177.            *  Qeditaccess   can  read  Jumbo  text  files  greater  than  256
  178.               characters wide.
  179.  
  180.  
  181.     ___ ________ __ _______ ___ _______ ______
  182.     New Features in Version 4.2 (August 1994):
  183.  
  184.  
  185.            *  Qeditaccess  has  been  upgraded  to  read  Qedit's  new  Jumbo
  186.               workfiles.   However,  Jumbo files with a record length of more
  187.               than 256 characters are rejected by the existing open functions
  188.               (this  is  for  backward compatibility).  If you are willing to
  189.               accept any record size in your program, use functions 30 to 32:
  190.  
  191.                  30 - open a file with any record size.
  192.                  31 - pass in a filenum already opened (any record size).
  193.                  32 - open a file with any record size, read serially.
  194.  
  195.            *  There are three new error numbers:
  196.  
  197.                  -6 for "Qaccess: Invalid format for Jumbo Qedit file"
  198.                  -7 for "Qaccess: use Jumbo Open (func 30) if rec>256"
  199.                  -8 for "Qaccess: Write/Append to jumbo not impl yet"
  200.  
  201.               Qeditaccess does not yet write Jumbo files.
  202.  
  203.  
  204.  
  205.     ________ __ _____
  206.     Overview of Qcopy
  207.  
  208.            Qcopy  expects commands in a format that is similar to FCOPY.  The
  209.            ________                               ______
  210.            fromfile is specified by FROM= and the tofile is specified by TO=.
  211.            The  TO=  portion  can be left off, in which case Qcopy copies the
  212.            ________
  213.            fromfile into itself, converting it  from  Qedit  format  to  Keep
  214.            format.   Qcopy  can  copy a group of files with a single command.
  215.                                 _______ _____
  216.            Refer to the chapter Copying Files for more information.
  217.  
  218.            Qcopy interprets any command line beginning with a colon (:) as an
  219.            MPE  command.   Only  the  commands that MPE allows in "break" are
  220.  
  221.                                           _______ _   _______ __ _____
  222.                                           Chapter 1   Welcome to Qcopy      3
  223.  
  224.  
  225.  
  226.            allowed in Qcopy.  This feature can be used to :PURGE  any  files,
  227.            obtain a :LISTF of files, or to include :COMMENT lines.
  228.  
  229.            For  information  on  Qcopy and Qeditaccess, use the Help command.
  230.            All of the information in  the  Qcopy  user  manual  is  available
  231.            on-line  through  the  Help  command.   For  help  on new features
  232.            recently added to Qcopy, type "Help News".  The Help  command  can
  233.            be abbreviated to "?".
  234.  
  235.  
  236.     ___ __ ___ _____
  237.     How to Run Qcopy
  238.  
  239.            We  include  two  copies  of  the  Qcopy  program:  Qcopy.Qlib and
  240.            QcopyNM.Qlib, which is a native-mode version for  MPE/iX  systems.
  241.            To  install  the  native-mode  version  of Qcopy as the production
  242.            version, use these commands:
  243.  
  244.                 :hello mgr.robelle,qlib
  245.                 :rename qcopy,qcopycm
  246.                 :rename qcopynm,qcopy
  247.  
  248.            To access Qcopy, type this command:
  249.  
  250.                 :run Qcopy.Qlib.Robelle
  251.  
  252.            Qcopy prints its version number and prompts with  ">".   You  type
  253.            commands,  ending  each  command  with  Return.  For example, type
  254.            "HELP":
  255.  
  256.                 >help
  257.  
  258.            Qcopy prints some help text and a keyword list.  Type  a  keyword,
  259.            or press Return to leave Help and return to Qcopy.
  260.  
  261.            Qcopy  accepts  commands  from $STDINX, the standard MPE job input
  262.            file.  This is usually the terminal or the stream file.   You  can
  263.            redirect  the input by using the STDIN option of the :RUN command.
  264.            Qcopy writes all  messages  to  $STDLIST,  the  standard  MPE  job
  265.            listing  file.   You  can redirect the output by using the STDLIST
  266.            option of the :RUN command.
  267.  
  268.            Qcopy can be run in batch,  but  Qcopy  will  abort  if  an  error
  269.            occurs.
  270.  
  271.            To leave Qcopy, type "EXIT" or "E".
  272.  
  273.  
  274.     __________ _____
  275.     Suspending Qcopy
  276.  
  277.            When  you  run  Qcopy from Qedit or Select, Exit suspends Qcopy so
  278.            that it can be re-activated quickly later.  If you run Qcopy  from
  279.            within  HPDESK  (and  some  other programs), Qcopy will suspend on
  280.            Exit but HPDESK will not notice.  The next  time  you  run  Qcopy,
  281.            HPDESK will create a new copy of the program.  Eventually you will
  282.  
  283.            _______ _   _______ __ _____
  284.     4      Chapter 1   Welcome to Qcopy
  285.  
  286.  
  287.  
  288.            have many suspended copies of Qcopy hanging from HPDESK, consuming
  289.            system resources.  You can force Qcopy to terminate on Exit rather
  290.            than suspend by running Qcopy with PARM=32.
  291.  
  292.                 :run qcopy.qlib.robelle;parm=32
  293.  
  294.                                                                             5
  295.  
  296.  
  297.  
  298.  
  299.     _______ _   _______ _____
  300.     Chapter 2   Copying Files
  301.  
  302.  
  303.                 _  _______ ______ __ _____
  304.                 *  Copying Groups of Files
  305.                 _  _______
  306.                 *  Options
  307.                 _  ________
  308.                 *  Examples
  309.  
  310.  
  311.            The command used to copy files is:
  312.  
  313.                        ________        ______   _______
  314.                 FROM = fromfile ; TO = tofile ; options
  315.  
  316.                     ________
  317.            The FROM=fromfile portion is  the  only  part  that  is  required.
  318.                            ________
  319.            Qcopy opens the fromfile as an old disc file with read access.  It
  320.            can be  any  Qedit  workfile,  or  any  standard  Keep  file  with
  321.            fixed-length or variable-length records.
  322.  
  323.                                              ________
  324.            Qcopy  reads  each  record in the fromfile and transfers it to the
  325.            ______            ________
  326.            tofile.  When the fromfile is a Qedit workfile, the resulting file
  327.            corresponds  to  what  you  would  get  by doing a Keep of a Qedit
  328.            workfile from within Qedit.  Where appropriate, line  numbers  are
  329.                                                 ______
  330.            included  in  each  record  of  the  tofile (columns 1-6 in COBOL,
  331.            columns 73-80 for SPL, FORTRAN, or Pascal, and no line number  for
  332.            RPG, JOB and TEXT files, unless 'SERIAL' is specified).
  333.  
  334.            If  the  entire  TO= portion of the command line is not specified,
  335.                ________
  336.            the fromfile is copied  into  itself.   WARNING:   you  need  save
  337.                                                   ________
  338.            access to the group and account of the fromfile in this case.
  339.  
  340.                    ______
  341.            If  the tofile file name is not specified, the records are printed
  342.                                 ______
  343.            on $STDLIST.  If the tofile file name is specified, it  is  opened
  344.            OLD  with  WRITE  access,  unless  the  'NEW' or 'Qedit' option is
  345.            specified.
  346.  
  347.            When the copy operation completes, Qcopy displays  the  number  of
  348.            records that were copied.  Qcopy then prompts for another command.
  349.            This continues until :EOF on  $STDINX  or  you  enter  the  "EXIT"
  350.            command.
  351.  
  352.            You  can  interrupt  a copy operation by pressing control-y.  This
  353.            will stop the copy immediately.  The  current  file  being  copied
  354.            will  be  closed and Qcopy will display the number of records that
  355.            were  written  to  the  file  before  the   copy   operation   was
  356.            interrupted.
  357.  
  358.  
  359.     _______ ______ __ _____
  360.     Copying Groups of Files
  361.  
  362.            Qcopy can copy an entire group of source files to another group or
  363.            back into itself.   The  syntax  to  copy  from  one  group  to  a
  364.            different group is:
  365.  
  366.                         _________      _______
  367.                 >FROM=@.fromgroup;TO=@.togroup;NEW
  368.  
  369.            _______ _   _______ _____
  370.     6      Chapter 2   Copying Files
  371.  
  372.  
  373.  
  374.            The  syntax  to  convert an entire group from Qedit format to Keep
  375.            format is:
  376.  
  377.                         _________
  378.                 >FROM=@.fromgroup
  379.  
  380.                                 _________
  381.            For each file in the fromgroup, a  file  with  the  same  name  is
  382.                              _______
  383.            created  in  the  togroup.   We  recommend  that you clear out the
  384.            _______
  385.            togroup first with a :PURGEGROUP command.
  386.  
  387.            To interrupt a group copy operation, press control-y.   This  will
  388.            stop  the copy immediately.  The current file being copied will be
  389.            closed and Qcopy will display the number of records written to the
  390.            file before the copy operation was interrupted.
  391.  
  392.            The group copy option can be combined with the 'INCLUDE' option to
  393.            provide a very convenient mechanism for distributing SPL, FORTRAN,
  394.            or Pascal applications in source code:
  395.  
  396.            1. Use  $INCLUDE for all FILE or DATASET record layouts and common
  397.               blocks in FORTRAN.
  398.  
  399.            2. Publish the names of the include files for your users.
  400.  
  401.            3. Distribute your source code in Qedit form in a  special  group.
  402.               This saves disc space.
  403.  
  404.            4. Users  who  want  to replace or expand the DATASET layouts, may
  405.               replace the appropriate 'INCLUDE' files, which  can  be  either
  406.               Qedit or Keep files, and :RUN Qcopy to move the entire group or
  407.               selected programs to another group.  The customized source code
  408.               is compatible with EDIT/3000.
  409.  
  410.            5. If  your  users  have  Qedit,  they can dispense with the Qcopy
  411.               operation completely and let the $INCLUDE operation  happen  at
  412.               compile-time, with the same customizing results.
  413.  
  414.  
  415.     _______
  416.     Options
  417.  
  418.            The  options  to  Qcopy  must  be separated by semi-colons and are
  419.            taken from the following list:
  420.  
  421.              _______
  422.              options = NEW INCLUDE UNN ERASE APPEND SERIAL QEDIT FTN
  423.  
  424.  
  425.     ___ ______
  426.     NEW Option
  427.  
  428.                            ______
  429.            By default, the tofile is an OLD disc file.  When the  NEW  option
  430.                                 ______
  431.            is  specified,  the  tofile is opened as a new disc file.  In this
  432.                      ______      ___
  433.            case, the tofile must not exist.  If it does, Qcopy will fail when
  434.                                   ______                               ______
  435.            it  tries to close the tofile.  If no TO= is specified, the tofile
  436.            is opened as a new disc file.
  437.  
  438.                                              _______ _   _______ _____
  439.                                              Chapter 2   Copying Files      7
  440.  
  441.  
  442.  
  443.     _______ ______
  444.     INCLUDE Option
  445.  
  446.            The 'INCLUDE' option causes Qcopy to look for $INCLUDE records and
  447.            replace them by the lines of the specified file.
  448.  
  449.                          ________
  450.                 $INCLUDE filename
  451.  
  452.                                                 ______
  453.            Qcopy  adds 10000 to the size of the tofile in order to allow room
  454.            for the included lines.  If  you  do  not  specify  the  'INCLUDE'
  455.            option,  the  lines  that  start  with  $INCLUDE are copied to the
  456.            ______
  457.            tofile without any change.
  458.  
  459.                                   ______
  460.            If you try to TEXT the tofile into EDIT/3000, it will detect  that
  461.            the sequence fields in the included lines are out of sequence, and
  462.            treat the file as  an  unnumbered  file.   You  may  have  to  set
  463.            right=72  and  length=72  to  eliminate the sequence fields.  With
  464.            Qedit, the file is automatically  resequenced  starting  with  the
  465.            first included line.
  466.  
  467.  
  468.     ___ ______
  469.     UNN Option
  470.  
  471.            This  option  causes  the  Qedit  file to be read without sequence
  472.            numbers in each line.   By  default,  Qedit  files  have  sequence
  473.            numbers unless the Language is Job, RPG or Text.
  474.  
  475.  
  476.     _____ ______
  477.     ERASE Option
  478.  
  479.                                                ______
  480.            This  option  specifies  that  the  tofile  is  an  old file whose
  481.            contents are to be overwritten.  This  may  seem  like  a  useless
  482.            option,  since  Qcopy  overwrites old files by default (unless you
  483.            specify the NEW or QEDIT options), but it isn't.  The ERASE option
  484.            is  the  only way you can get Qcopy to erase and overwrite a Qedit
  485.            workfile.
  486.  
  487.  
  488.     ______ ______
  489.     APPEND Option
  490.  
  491.                                           ______
  492.            This option specifies that the tofile is an existing file that you
  493.            want  to  append  lines to.  The old file may be a Qedit file or a
  494.            Keep file.
  495.  
  496.  
  497.     _____ ______
  498.     QEDIT Option
  499.  
  500.            Normally, Qcopy reads a Qedit file and  creates  a  standard  Keep
  501.            file.   The  QEDIT option reverses this by reading a Keep file and
  502.            creating a Qedit file.
  503.  
  504.                        ____
  505.            This option only works for new files (the NEW option is  assumed).
  506.            With  this  option there is no way to write over an existing file.
  507.            Use the ERASE option instead if you want to write over an existing
  508.            Qedit file.  This option also works with group copies.
  509.  
  510.            _______ _   _______ _____
  511.     8      Chapter 2   Copying Files
  512.  
  513.  
  514.  
  515.     ___ ______
  516.     FTN Option
  517.  
  518.            Qcopy has no method of distinguishing FORTRAN or Pascal Keep files
  519.            from SPL Keep files.  All Keep files with record  numbers  in  the
  520.            last eight columns are assumed to be SPL files.
  521.  
  522.            If  you want the new Qedit files to be identified as FORTRAN files
  523.            instead of SPL (when it is ambiguous), use the FTN option with the
  524.            Qedit  option.   This changes the default language when converting
  525.            Keep files with 8-byte sequence numbers.
  526.  
  527.  
  528.     ___ ______
  529.     PAS Option
  530.  
  531.            This option is similar to the FTN option, except that it sets  the
  532.            default language to Pascal when converting Keep files.
  533.  
  534.  
  535.     ________
  536.     Examples
  537.  
  538.            1. Convert  a  Qedit file to Keep format.  In this case the output
  539.                    ____
  540.               file must exist.
  541.  
  542.                    :run Qcopy.qlib.robelle
  543.                    >from=qfile;to=kfile
  544.                    >exit
  545.  
  546.  
  547.            2. Convert a Qedit file to Keep format, but the output  file  does
  548.               not already exist:
  549.  
  550.                    :run Qcopy.qlib.robelle
  551.                    >from=qfile;to=kfile;new
  552.                    >exit
  553.  
  554.  
  555.            3. Convert  a  Qedit file with $INCLUDE lines to Keep format.  The
  556.               $INCLUDE files will be copied to the output file at the correct
  557.               place.  The output file does not already exist.
  558.  
  559.                    :run Qcopy.qlib.robelle
  560.                    >from=qfile;to=kfile;new;include
  561.                    >exit
  562.  
  563.  
  564.            4. Convert  a  Qedit file into Keep format by copying it back into
  565.               itself.
  566.  
  567.                    :run Qcopy.qlib.robelle
  568.                    >from=qfile
  569.                    >exit
  570.  
  571.                                              _______ _   _______ _____
  572.                                              Chapter 2   Copying Files      9
  573.  
  574.  
  575.  
  576.            5. Copy  an  entire  group  of  Qedit  files  to  another   group,
  577.               converting  each  file  to Keep format.  First, we logon in the
  578.               destination group and use the :PURGEGROUP command to purge  all
  579.               of  the  existing files.  Because we are logged on in the group
  580.                                              ___
  581.               we are purging, the group will not be purged,  only  the  files
  582.               will be.
  583.  
  584.                    :hello mgr.dev,ksource
  585.                    :purgegroup ksource
  586.                    :run Qcopy.qlib.robelle
  587.                    >from=@.qsource;to=@.ksource;new
  588.                    >exit
  589.  
  590.  
  591.            6. Copy  an  entire  group  into itself.  This converts each Qedit
  592.               file in the group to Keep format.
  593.  
  594.                    :hello mgr.dev,qsource
  595.                    :run Qcopy.qlib.robelle
  596.                    >from=@.qsource
  597.                    >exit
  598.  
  599.  
  600.                                                             ______
  601.            7. Convert a Keep file to  Qedit  format.   The  tofile  must  not
  602.               already exist:
  603.  
  604.                    :run Qcopy.qlib.robelle
  605.                    >:purge qfile
  606.                    >from=kfile;to=qfile;qedit
  607.                    >exit
  608.  
  609.  
  610.            8. Convert an entire group from Keep format to Qedit format.  Each
  611.               source file will be converted.  Binary files will  be  ignored,
  612.               but ASCII data files will be converted to Qedit format:
  613.  
  614.                    :hello mgr.dev,ksource
  615.                    :run Qcopy.qlib.robelle
  616.                    >from=@.ksource;qedit
  617.                    >exit
  618.  
  619.  
  620.                                                                   ______
  621.            9. Convert  a  FORTRAN Keep file to Qedit format.  The tofile must
  622.               not already exist:
  623.  
  624.                    :run Qcopy.qlib.robelle
  625.                    >:purge qfile
  626.                    >from=kfile;to=qfile;qedit;ftn
  627.                    >exit
  628.  
  629.     10
  630.  
  631.  
  632.  
  633.  
  634.     _______ _   ________ _____ ___ ______ ______
  635.     Chapter 3   Recovery Using the SERIAL Option
  636.  
  637.  
  638.                 _  ____________
  639.                 *  Introduction
  640.                 _  ________
  641.                 *  Examples
  642.  
  643.  
  644.     ____________
  645.     Introduction
  646.  
  647.            The "SERIAL" option is used to recover Qedit workfiles  that  have
  648.            been   corrupted.    Qedit  workfiles  have  an  internal  linkage
  649.            structure that keeps all of the lines in line number order.  It is
  650.            possible  that  through  a  system  crash  these pointers could be
  651.            incorrect.  When this  happens,  Qedit  goes  through  a  recovery
  652.            procedure.   It is possible that the Qedit recovery will fail.  In
  653.            this case, use 'SERIAL' to recover the file.
  654.  
  655.            The SERIAL option causes Qcopy to  read  records  from  the  Qedit
  656.            workfile  in  serial  order.   Qcopy  ignores the internal linkage
  657.            pointers of the workfile.  Of course, the resulting lines will not
  658.            be in the correct order.
  659.  
  660.                                             ______       ______
  661.            When  using  this  option,  the  tofile  will always have sequence
  662.            numbers.  This means that 88-byte records will  be  generated  for
  663.            JOB/RPG files, with sequence numbers in columns 81 through 88, and
  664.            264-byte records for TEXT files, with sequence numbers in  columns
  665.                                      ______
  666.            257  through  264.   The  tofile  must  then be sorted by sequence
  667.            number in order to put the records back in their correct order.
  668.  
  669.  
  670.     ________
  671.     Examples
  672.  
  673.            1.  Recovery of a COBOL or a COBOLX file:
  674.  
  675.                    :run Qcopy.qlib.robelle
  676.                    >:purge k
  677.                    >:purge ksorted
  678.                    >from=cobprog;to=k;new;serial
  679.                    >exit
  680.                    :comment k = unsorted lines of cobprog
  681.                    :run sort.pub.sys
  682.                    >input k
  683.                    >output ksorted
  684.                    >key 1,6
  685.                    >end
  686.                    :comment ksorted contains recovered cobprog.
  687.                    :run Qedit.pub.robelle
  688.                    /t cobnew=ksorted
  689.  
  690.               If there are any duplicate lines, Qedit prints
  691.  
  692.                    WARNING:  Linenum
  693.  
  694.                           _______ _   ________ _____ ___ ______ ______
  695.                           Chapter 3   Recovery Using the SERIAL Option     11
  696.  
  697.  
  698.  
  699.               and renumbers the lines after the first duplicate line.
  700.  
  701.            2.  Recovery of a SPL, FORTRAN, or Pascal file:
  702.  
  703.                    :run Qcopy.qlib.robelle
  704.                    >:purge k
  705.                    >:purge ksorted
  706.                    >from=splprog;to=k;new;serial
  707.                    >exit
  708.                    :run sort.pub.sys
  709.                    >input k
  710.                    >output ksorted
  711.                    >key 73,8
  712.                    >end
  713.                    :run Qedit.pub.robelle
  714.                    /t splnew=ksorted
  715.  
  716.            3.  Recovery of a RPG or JOB file:
  717.  
  718.                    :run Qcopy.qlib.robelle
  719.                    >:purge k
  720.                    >:purge ksorted
  721.                    >from=jobprog;to=k;new;serial
  722.                    >exit
  723.                    :run sort.pub.sys
  724.                    >input k
  725.                    >output ksorted
  726.                    >key 81,8
  727.                    >end
  728.                    :run Qedit.pub.robelle
  729.                    /t jobnew=ksorted
  730.  
  731.            4.  Recovery of a TEXT file:
  732.  
  733.                    :run Qcopy.qlib.robelle
  734.                    >:purge k
  735.                    >:purge ksorted
  736.                    >from=textprog;to=k;new;serial
  737.                    >exit
  738.                    :run sort.pub.sys
  739.                    >input k
  740.                    >output ksorted
  741.                    >key 257,8
  742.                    >end
  743.                    :run Qedit.pub.robelle
  744.                    /t textnew=ksorted
  745.  
  746.     12
  747.  
  748.  
  749.  
  750.  
  751.     _______ _   ___________ _________
  752.     Chapter 4   Qeditaccess Procedure
  753.  
  754.  
  755.                 _  ____________
  756.                 *  Introduction
  757.                 _  ________ _________
  758.                 *  Function Parameter
  759.                 _  _________ _________
  760.                 *  Workspace Parameter
  761.                 _  ________ _________
  762.                 *  Argument Parameter
  763.                 _  ______ _______ __ _______ _ _____ ____
  764.                 *  Pascal Example of Reading a Qedit File
  765.                 _  ___ _______ __ _______ _ _____ ____
  766.                 *  SPL Example of Reading a Qedit File
  767.                 _  _____ _______ __ _______ _____ __ ___
  768.                 *  COBOL Program to Convert Qedit to MPE
  769.                 _  _____ _______ __ _______ ___ __ _____
  770.                 *  COBOL Program to Convert MPE to Qedit
  771.  
  772.  
  773.     ____________
  774.     Introduction
  775.  
  776.            Qeditaccess is a general-purpose interface  routine  that  can  be
  777.            called  by  a  user  program  written  in  COBOL, FORTRAN, SPL, or
  778.            Pascal.  It is used to access source files  in  programs  such  as
  779.            text  formatters,  assemblers, compilers, cross references, and so
  780.            on.  It will open, read, rewind, and  close  any  ordinary  source
  781.            file.   It also supports these same functions for Qedit workfiles,
  782.            making them look to the user program as if they were normal source
  783.            files  with fixed-length records.  Other functions of Qeditaccess:
  784.            find by line number function for Qedit files only, open new  Qedit
  785.            file,  open old Qedit file (and erase), write to Qedit file, close
  786.            as permanent file, and close as temporary file.
  787.  
  788.            A shorter name, QACCESS,  is  provided  for  programs  written  in
  789.            Pascal Robelle (or any other language that restricts the length of
  790.            identifiers).
  791.  
  792.            Qeditaccess is a routine of the Qcopy  program,  but  it  is  also
  793.            distributed   separately   in   both   object  and  source  format
  794.            (qaccess.qlibsrc.robelle).  Qeditaccess may be used by anyone  who
  795.            wants  their  software  to read Qedit workfiles; it may be used in
  796.            software  products  provided  that  both  Qedit  and  Robelle  are
  797.            acknowledged in the product documentation.  We also recommend that
  798.            anyone who is using Qeditaccess and is not a customer  of  Robelle
  799.            should inform us that Qeditaccess is being used.  Robelle reserves
  800.            the right to change the format of Qedit workfiles and the code  to
  801.                           ___
  802.            Qeditaccess at any time in the future.
  803.  
  804.            Qeditaccess is declared in an SPL program as:
  805.  
  806.              Procedure Qeditaccess ( Function, Workspace, Argument );
  807.                 Integer Array Function;
  808.                 Array Workspace, Argument;
  809.                 Option External, Check 2;
  810.  
  811.            All  parameters are passed by reference so that Qeditaccess can be
  812.            called  from  COBOL  programs.   For  details  on  how   to   call
  813.            Qeditaccess  from  SPL,  Pascal  and  COBOL, refer to the examples
  814.            below.
  815.  
  816.                                      _______ _   ___________ _________
  817.                                      Chapter 4   Qeditaccess Procedure     13
  818.  
  819.  
  820.  
  821.            When using any of the read functions (2, 8 or  17),  the  Argument
  822.            parameter  is  a  buffer  where  the  data  is going to be stored.
  823.            Qaccess returns up to 8,172 characters for  text  files.   If  the
  824.            file  records  are  wider,  Qaccess truncates the records.  If the
  825.            buffer is  too  small  for  the  requested  text,  the  result  is
  826.            unpredictable.
  827.  
  828.            The limit is 1,000 characters for Qedit workfiles (jumbo).  If you
  829.            are trying to access  wide-jumbo  workfiles,  Qaccess  returns  an
  830.            error (-9).
  831.  
  832.     ________ _________
  833.     Function Parameter
  834.  
  835.            Although  Function is defined as an integer array, it is only used
  836.            as a single word integer, PIC  S9(4)  COMP  in  COBOL,  except  in
  837.            functions  9  to 16.  The first word of Function tells Qeditaccess
  838.            what task to perform.  The valid function values are 1 through 18,
  839.            plus 30 and 31.
  840.  
  841.  
  842.     _______ __ ________ ___ ________
  843.     Summary of Function and Argument
  844.  
  845.            Function  Use                              Argument
  846.  
  847.            1         Open a file for read             filename
  848.            2         Read the next record             line read
  849.            3         Close file after reading         unused
  850.            4         Rewind                           unused
  851.            5         Serial open for read             filename
  852.            6         Find line number                 line number (in)
  853.                                                       line read (out)
  854.            7         Already open for read            file number
  855.            8         Read unnumbered                  line read
  856.            9         Open new Qedit file              filename
  857.            10        Save/Close as permanent file     unused
  858.            11        Save/Close as temporary file     unused
  859.            12        Write line                       line to write
  860.            13        Open for write, erase            filename
  861.            14        Already open for write, erase    file number
  862.            15        Open for write, append           filename
  863.            16        Already open for write, append   file number
  864.            17        Read line                        line read
  865.            18        Explain error number             message
  866.            30        open for read, any reclen        filename
  867.            31        already open for read, any rec   filenum
  868.            32        open for serial read, any rec    filename
  869.  
  870.  
  871.            __ ____ _ _____ ___ ____ ____ ______
  872.            1. Open a file, OLD with READ access
  873.  
  874.               Argument  contains  the file name, which may be a Qedit or Keep
  875.               file, permanent or temporary.  See  word  5  of  the  Workspace
  876.               (e.g.,  Workspace(4)  in SPL) for the record length in bytes of
  877.               the file.  Files with record lengths longer than 256 characters
  878.  
  879.            _______ _   ___________ _________
  880.     14     Chapter 4   Qeditaccess Procedure
  881.  
  882.  
  883.  
  884.               are  rejected,  since  previous  versions specified that as the
  885.               maximum size of the Argument  parameter  on  read  calls.   Use
  886.               Functions 30 or 31 to access files or any record size.
  887.  
  888.  
  889.            __ ____ ___ ____ ______
  890.            2. Read the next record
  891.  
  892.               The  record  is  returned  in Argument.  If the file is a Qedit
  893.               file that we think of as numbered (e.g., COBOL,  SPL,  FORTRAN,
  894.               or  Pascal),  the  line  number will be formatted in ASCII just
  895.               like an EDIT/3000 Keep file.  The length of the record read  is
  896.               returned  in  word  10  of the Workspace.  For Qedit files, the
  897.               line number is also returned as a 32-bit integer in Words 6 and
  898.               7 of the Workspace parameter.
  899.  
  900.                                                            ____
  901.               If  the file was opened with function 1, the next record is the
  902.               next  logical  record  in  the  file  (i.e.,  in  line   number
  903.                                                                          ____
  904.               sequence).   If  the  file was opened with function 5, the next
  905.               record is the next physical  record  in  the  file  (i.e.,  MPE
  906.               record sequence).
  907.  
  908.  
  909.            __ _____ ____ _____ _______
  910.            3. Close file after reading
  911.  
  912.               Use  this  function with read-access files (functions 1, 5, and
  913.               7).  Argument is unused.
  914.  
  915.  
  916.            __ ______
  917.            4. Rewind
  918.  
  919.               Rewind the file to the beginning  in  preparation  for  reading
  920.               again.  Argument is unused.
  921.  
  922.  
  923.            __ ______ ____
  924.            5. Serial Open
  925.  
  926.               Open  the  file  for serial read access.  This function is used
  927.               with the 'SERIAL' option of Qcopy described previously.
  928.  
  929.  
  930.            __ ____ ____ ______
  931.            6. Find Line Number
  932.  
  933.               Find the line with a line number greater than or equal  to  the
  934.               line   number  specified  in  Argument.   The  target  line  is
  935.               specified as a 32-bit INTEGER or S9(9) COMP in COBOL.  The line
  936.               itself  is  returned in the same Argument parameter, so be sure
  937.               to allow room.  The line number of the line found  is  returned
  938.               in  words  6  and  7  of  the Workspace parameter.  If the line
  939.               number target is higher than the last line in the file,  -1  is
  940.               returned  in  the  Status word of the Workspace.  Remember that
  941.               line 1 is really line 1.000 or 1000 when  stored  as  a  32-bit
  942.               INTEGER.
  943.  
  944.               ____  ________  ____  _____  ___  _____  _____
  945.               This  function  only  works  for  Qedit  files  (word  3 of the
  946.  
  947.                                      _______ _   ___________ _________
  948.                                      Chapter 4   Qeditaccess Procedure     15
  949.  
  950.  
  951.  
  952.               Workspace' must be 1, not 0  or  2)  that  are  open  for  read
  953.               access.
  954.  
  955.  
  956.            __ _______ ____
  957.            7. Already Open
  958.  
  959.               Argument  contains  the  file  number  of  a file that you have
  960.               already opened with FOPEN for read access.   This  function  is
  961.               like  function  1, except that you do the FOPEN yourself.  With
  962.               this function, you can choose to call Qeditaccess only  if  the
  963.               filecode is 111 (instead of for every file).
  964.  
  965.  
  966.            __ ____ __________
  967.            8. Read Unnumbered
  968.  
  969.               For  Keep  files,  this  function is just like function 2.  For
  970.               Qedit files, the sequence number is not returned as part of the
  971.               line.   Instead,  Words  6  and 7 of the Workspace contains the
  972.               sequence number.  Word 10 of the Workspace (e.g.,  Workspace(9)
  973.               in  SPL) contains the length in bytes of the line just returned
  974.               (less trailing blanks).  Argument always returns  a  fixed-size
  975.               record  with trailing blanks.  For COBOL Qedit files, the first
  976.               character returned is column 7.
  977.  
  978.               If you want to read Keep files the same way as Qedit files, use
  979.               function 17.
  980.  
  981.  
  982.            __ ____ ___ _____ ____
  983.            9. Open New Qedit File
  984.  
  985.               Function  is an integer array that describes the new file.  For
  986.               SPL calls, subtract 1 from offsets.
  987.  
  988.                 Function(1) = 9, Open New Qedit file
  989.                 Function(2)  Language  1=SPL, 2=Ftn, 3=COBOL, 4=RPG,
  990.                                        5=Job,  6=Text,  7=Pascal,   8=CobolX,
  991.               9=Data
  992.                 Function(3)  Recsize in bytes, needed if Language=6 (text)
  993.                 Function(4)  Number of Blocks, allow Lines/8 blocks
  994.                 Function(5)  Number of Extents (1-32)
  995.                 Function(6)  Initial Extents (1-number of extents)
  996.  
  997.               Argument  contains the name of the new file.  Qeditaccess opens
  998.               the new file and prepares to write lines into it (see  function
  999.               12).   If  the file is a duplicate, you will not find out until
  1000.               you try to close it (see function 10 or 11).
  1001.  
  1002.  
  1003.            _____________ __ _________ ____
  1004.            10.Save/Close As Permanent File
  1005.  
  1006.               Closes the current write-access file  as  Save-Permanent.   Use
  1007.               this  function,  not  function  3, with functions 13 to 16 (old
  1008.               files, write-access) and and with function 9 (new Qedit  file).
  1009.               For  new Qedit files, function 10 will fail if the file already
  1010.  
  1011.            _______ _   ___________ _________
  1012.     16     Chapter 4   Qeditaccess Procedure
  1013.  
  1014.  
  1015.  
  1016.               exists.  Argument is unused.
  1017.  
  1018.  
  1019.            _____________ __ _________ ____
  1020.            11.Save/Close As Temporary File
  1021.  
  1022.               Closes the new Qedit file (see function  9  above)  as  an  old
  1023.               temporary  file.   Will  fail if the file already exists in the
  1024.               job domain.  Argument is unused.
  1025.  
  1026.  
  1027.            ________ ____
  1028.            12.Write Line
  1029.  
  1030.               Writes a new line to the end of a  Qedit  file  that  has  been
  1031.               opened  for  write  access  (functions  9,  13,  14,  15,  16).
  1032.               Argument contains the variable-length data for  the  new  line.
  1033.               Function  is  an  integer array that defines the byte length of
  1034.               the new line and the line number.   For  SPL  subtract  1  from
  1035.               offsets.
  1036.  
  1037.                 Function(1) = 12, Write new line
  1038.                 Function(2)  Recsize in bytes, positive
  1039.                 Function(3/4) Line number, 32-bit integer, line 5 is 5000
  1040.                               Pass zero (0) every time if you would like
  1041.                               Qeditaccess to assign line numbers itself
  1042.  
  1043.  
  1044.            _______ ___ ______ _____
  1045.            13.Open For Write, Erase
  1046.  
  1047.               Argument contains the name of an existing Qedit or Keep file to
  1048.               open.  The existing contents of the  file  will  be  destroyed.
  1049.               Function  is  an integer array that describes what type of data
  1050.               you plan to write into the file.   For  SPL,  subtract  1  from
  1051.               offsets.
  1052.  
  1053.                 Function(1) = 13, Open for Write, Erase
  1054.                 Function(2)  Language  1=SPL, 2=Ftn, 3=COBOL, 4=RPG,
  1055.                                        5=Job,   6=Text,  7=Pascal,  8=CobolX,
  1056.               9=Data
  1057.                 Function(3)  Recsize in bytes, needed if Language=6 (text)
  1058.  
  1059.  
  1060.            __________ ____ ___ ______ _____
  1061.            14.Already Open For Write, Erase
  1062.  
  1063.               This is just like function 13, except that the caller opens the
  1064.               file.   Argument  contains the file number of an existing Qedit
  1065.               or Keep file.  Qedit  files  must  be  opened  with  Read/Write
  1066.               access.   The  existing contents of the file will be destroyed.
  1067.               Function is an integer array that describes what type  of  data
  1068.               you  plan  to  write  into  the file.  For SPL, subtract 1 from
  1069.               offsets.
  1070.  
  1071.                 Function(1) = 14, Already Open for Write, Erase
  1072.                 Function(2)  Language  1=SPL, 2=Ftn, 3=COBOL, 4=RPG,
  1073.                                        5=Job,  6=Text,  7=Pascal,   8=CobolX,
  1074.  
  1075.                                      _______ _   ___________ _________
  1076.                                      Chapter 4   Qeditaccess Procedure     17
  1077.  
  1078.  
  1079.  
  1080.               9=Data
  1081.                 Function(3)  Recsize in bytes, needed if Language=6 (text)
  1082.  
  1083.  
  1084.            _______ ___ ______ ______
  1085.            15.Open For Write, Append
  1086.  
  1087.               Argument contains the name of an existing Qedit or Keep file to
  1088.               open for Append Access.  The existing contents of the file will
  1089.               be preserved.  Function is an integer array that describes what
  1090.               type of data you plan to write into the file.  If the  existing
  1091.                                           ___
  1092.               file  is  a  Qedit workfile and empty, Qeditaccess gives it the
  1093.               Language and Length you specify.  If the file contains lines or
  1094.               is  not  a  Qedit  file,  Qeditaccess  ignores  your  requested
  1095.               Language and Length.  For SPL, subtract 1 from offsets.
  1096.  
  1097.                 Function(1) = 15, Open Existing File to Append
  1098.                 Function(2)  Language  1=SPL, 2=Ftn, 3=COBOL, 4=RPG,
  1099.                                        5=Job,  6=Text,  7=Pascal,   8=CobolX,
  1100.               9=Data
  1101.                 Function(3)  Recsize in bytes, needed if Language=6 (text)
  1102.  
  1103.  
  1104.            __________ ____ ___ ______ ______
  1105.            16.Already Open For Write, Append
  1106.  
  1107.               Argument  contains the file number of an existing Qedit or Keep
  1108.               file that the caller has opened.  Qeditaccess  accepts  it  for
  1109.               append  access.   To  append  to a Qedit file you must open the
  1110.               file with Read/Write access.  Function is an integer array that
  1111.               describes  what  type  of data you plan to write into the file.
  1112.                                                        ___
  1113.               If the existing file is a Qedit workfile and empty, Qeditaccess
  1114.               gives  it  the  Language  and  Length you specify.  If the file
  1115.               contains lines or is not a Qedit file, Qeditaccess ignores your
  1116.               requested  Language  and  Length.   For  SPL,  subtract  1 from
  1117.               offsets.
  1118.  
  1119.                 Function(1) = 16, Already Open for Write, Append
  1120.                 Function(2)  Language  1=SPL, 2=Ftn, 3=COBOL, 4=RPG,
  1121.                                        5=Job,  6=Text,  7=Pascal,   8=CobolX,
  1122.               9=Data
  1123.                 Function(3)  Recsize in bytes, needed if Language=6 (text)
  1124.  
  1125.  
  1126.            _______ ____
  1127.            17.Read Line
  1128.  
  1129.               This function is like function 8, except that it works the same
  1130.               for both Qedit and Keep files.  Argument returns  a  fixed-size
  1131.               record  with  trailing  blanks.  The sequence number is removed
  1132.               from the line, and words 6 and 7 of the Workspace  contain  the
  1133.               sequence  number.   If  the  file  is  unnumbered, the sequence
  1134.               number returned starts at 1.000, then 2.000, etc.  Word  10  of
  1135.               the  Workspace  contains the byte length of the line read (less
  1136.               trailing blanks).
  1137.  
  1138.            _______ _   ___________ _________
  1139.     18     Chapter 4   Qeditaccess Procedure
  1140.  
  1141.  
  1142.  
  1143.            __________
  1144.            18.Explain
  1145.  
  1146.               Put  a  one-line  explanation  of  the  Workspace  status  into
  1147.               Argument.   Word 10 of the Workspace contains the length of the
  1148.               explanation in bytes.
  1149.  
  1150.  
  1151.            _______ _ ____ __ ___ _______ ____ ____ ______
  1152.            30.Open a file of any Recsize with READ access
  1153.  
  1154.               Function 30 is identical to function  1,  except  that  a  file
  1155.               record length of more than 256 characters is allowed.  Argument
  1156.               contains the file name, which may  be  either  a  permanent  or
  1157.               temporary  Qedit  or  Keep  file.   See word 5 of the Workspace
  1158.               (e.g.,  Workspace(4)  in  SPL)  for  the   record   length   in
  1159.               characters.  You must provide a buffer of at least this size in
  1160.               any read calls that you make.
  1161.  
  1162.            __________ ________ _______ ____
  1163.            31.Anysize Records, Already Open
  1164.  
  1165.               Function 31 is identical to function 7, except  that  a  record
  1166.               length  of  more than 256 characters is allowed.  See word 5 of
  1167.               the Workspace (e.g., Workspace(4) in SPL) for the record length
  1168.               in characters.  You must provide a buffer of at least this size
  1169.               in any read calls that you make.
  1170.  
  1171.               Argument contains the file number  of  a  file  that  you  have
  1172.               already  opened  with  FOPEN for read access.  This function is
  1173.               like function 1, except that you do the FOPEN  yourself.   With
  1174.               this  function,  you can choose to call Qeditaccess only if the
  1175.               filecode is 111 (rather than for every file).
  1176.  
  1177.  
  1178.            ______ ______ ____ _ ______ ____
  1179.            32.Any Record Size - Serial Open
  1180.  
  1181.               Open a file with any record size for serial read  access.   See
  1182.               word  5  of  the  Workspace (e.g., Workspace(4) in SPL) for the
  1183.               record length in characters.  You must provide a buffer  of  at
  1184.               least this size in any read calls that you make.  This function
  1185.               is used with the Serial option of  Qcopy,  which  is  described
  1186.               elsewhere.
  1187.  
  1188.  
  1189.     _________ _________
  1190.     Workspace Parameter
  1191.  
  1192.            The Workspace is a 270-word (540-byte) array that must be provided
  1193.            for each file to be opened.  This array is used to  hold  the  MPE
  1194.            file number and other information about the file.  In addition, it
  1195.            returns the status of the last operation.  The words of the  array
  1196.            are defined as follows.
  1197.  
  1198.                                      _______ _   ___________ _________
  1199.                                      Chapter 4   Qeditaccess Procedure     19
  1200.  
  1201.  
  1202.  
  1203.     _______ __ _________ __________
  1204.     Summary of Workspace Parameters
  1205.  
  1206.                  Offset    Contents Explanation
  1207.  
  1208.                  word 1    Status  MPE error number of last operation,
  1209.                                    or 0 if ok, or -1 for end of file
  1210.                                    Qeditaccess errors are negative numbers
  1211.  
  1212.                  word 2    Filenum MPE filenumber returned by FOPEN
  1213.                                    Can be used to call print'file'info
  1214.  
  1215.                  word 3    Type    0=Keep file, 1=a Qedit file,
  1216.                                    2=other, 3=new Qedit file,
  1217.                                    4=erase MPE file, 5=append MPE file,
  1218.                                    6=erase Qedit file,
  1219.                                    7=append Qedit file
  1220.  
  1221.                  word 4    Lang    0=unknown, 1=spl, 2=ftn, 3=cob, 4=rpg,
  1222.                                    5=job, 6=text, 7=pascal, 8=cobolx, 9=data
  1223.  
  1224.                  word 5    Length  The record length in bytes
  1225.                                    For variable length files, the maximum
  1226.                                    possible length of a record
  1227.  
  1228.                  word 6/7  Size or OPEN function, number of lines in file
  1229.                            Curkey  FIND function, line number of this line
  1230.                                    READ functions, line number of line
  1231.  
  1232.                  word 8    Block   Current disc block
  1233.                                    (Qedit regular files only)
  1234.  
  1235.                  word 9    Index   Current index into block (Qedit only)
  1236.  
  1237.                  word 10   Readlen Length in bytes of last record read
  1238.  
  1239.                  word 11   Left    0=linenum at right end of record
  1240.                                    1=linenum at left end of record
  1241.  
  1242.                  word 12   Keylen  Length of the line number key in bytes
  1243.  
  1244.                  word 13/14        reserved for internal use
  1245.  
  1246.                  word 15-270       buffer space for Qedit file
  1247.  
  1248.  
  1249.            __ ______
  1250.            1. Status
  1251.  
  1252.               This   contains  the  MPE  error  number  of  last  Qeditaccess
  1253.               operation.  You can use  this  value  to  call  ferrmsg.   A  0
  1254.               indicates  no  error,  and end of file is indicated by a -1.  A
  1255.               negative error number indicates an internal Qeditaccess error.
  1256.  
  1257.                    -1  End of file.
  1258.                    -2  File record length greater than 256.
  1259.  
  1260.            _______ _   ___________ _________
  1261.     20     Chapter 4   Qeditaccess Procedure
  1262.  
  1263.  
  1264.  
  1265.                    -3  File system error reading block one,
  1266.                        Fcheck unable to find error.
  1267.                    -4  Invalid function.
  1268.                    -5  File system error, Fcheck unable to find error.
  1269.                    -6  Invalid format for Jumbo Qedit file.
  1270.                    -7  Use Jumbo Open (func 30) if rec>256
  1271.                    -8  Write/Append to Jumbo not implemented yet.
  1272.                    72  This error commonly occurs when you try to use
  1273.                        a function not compatible with the way the file is
  1274.                        opened (e.g., writing to a file opened for read).
  1275.  
  1276.  
  1277.            __ ____ ______
  1278.            2. File number
  1279.  
  1280.               This contains the MPE filenumber returned by FOPEN.  You can be
  1281.               used it to call print'file'info.
  1282.  
  1283.  
  1284.            __ ____ ____
  1285.            3. File type
  1286.  
  1287.               This  contains  the  type  of  the file detected by Qeditaccess
  1288.               after you call one of the Open functions.
  1289.  
  1290.                    0   Keep file
  1291.                    1   Qedit file
  1292.                    2   Other/Binary
  1293.                    3   New Qedit file
  1294.                    4   Erase MPE file
  1295.                    5   Append MPE file
  1296.                    6   Erase Qedit file
  1297.                    7   Append Qedit file
  1298.  
  1299.  
  1300.            __ ________
  1301.            4. Language
  1302.  
  1303.               This contains the language type of the file.  For the  Open  or
  1304.               Read  functions, Qeditaccess tries to determine the language of
  1305.               the file by looking at the first  record.   For  the  Open  for
  1306.               Write functions, this contains the language that you passed via
  1307.               the Function parameter.
  1308.  
  1309.                    0   Unknown
  1310.                    1   SPL
  1311.                    2   Fortran
  1312.                    3   Cobol
  1313.                    4   RPG
  1314.                    5   Job
  1315.                    6   Text
  1316.                    7   Pascal
  1317.                    8   CobolX
  1318.                    9   Data
  1319.  
  1320.                                      _______ _   ___________ _________
  1321.                                      Chapter 4   Qeditaccess Procedure     21
  1322.  
  1323.  
  1324.  
  1325.            __ _______
  1326.            5. Recsize
  1327.  
  1328.               This contains the maximum length of a record in the file.   For
  1329.               Qedit  files,  this  depends  on the language of the file.  For
  1330.               Keep files, this is the length of each  record.   For  variable
  1331.               length  files,  this is the longest record that could be in the
  1332.               file.  If you  just  converted  a  file  into  variable  length
  1333.               format,  then this value is likely going to be much larger than
  1334.               the longest actual record.
  1335.  
  1336.  
  1337.            ________ ____ __ ____ ______
  1338.            6,7.File Size or line number
  1339.  
  1340.               This 32-bit integer could contain several values, depending  on
  1341.               which Qeditaccess function was called.  After an OPEN function,
  1342.               this contains the number  of  lines  in  file.   After  a  FIND
  1343.               function, this contains the line number of the found, which may
  1344.               be different than the line you requested  if  you  specified  a
  1345.               non-existent  line.   After  a READ function, this contains the
  1346.               line number of the line just read.
  1347.  
  1348.  
  1349.            __ _____ _____
  1350.            8. Qedit Block
  1351.  
  1352.               This contains the block number of the current disc block.  This
  1353.               is only valid for Qedit files.
  1354.  
  1355.  
  1356.            __ _____ _____
  1357.            9. Qedit Index
  1358.  
  1359.               This  contains  the  current index into the current disc block.
  1360.               This is only valid for Qedit files.
  1361.  
  1362.  
  1363.            _______ ______
  1364.            10.Read Length
  1365.  
  1366.               This contains the length in bytes of the last record read.  For
  1367.               Qedit  files,  this  is the length of the line without trailing
  1368.               blanks.  For Keep and variable length files,  this  depends  on
  1369.               which  Read  function  was called.  For Read functions 2 and 8,
  1370.               this is the  length  of  the  actual  record  read.   For  Read
  1371.               function  17,  this  is the length of line without line numbers
  1372.               and without  trailing  blanks.   You  should  use  Read  Length
  1373.               instead of Recsize when you access the record.
  1374.  
  1375.  
  1376.            _______ ____
  1377.            11.Left Flag
  1378.  
  1379.               This  contains  a flag indicating where the line number is in a
  1380.               record.  For most MPE files (except COBOL), the line number  is
  1381.               at the end of the record.  COBOL files have line numbers at the
  1382.               beginning of the record.
  1383.  
  1384.                    0   Linenum at right end of record
  1385.  
  1386.            _______ _   ___________ _________
  1387.     22     Chapter 4   Qeditaccess Procedure
  1388.  
  1389.  
  1390.  
  1391.                    1   Linenum at left end of record
  1392.  
  1393.  
  1394.            ______ ______
  1395.            12.Key Length
  1396.  
  1397.               This contains the length of the line number key in bytes.   For
  1398.               COBOL,  the  line number is 6 bytes long.  For other languages,
  1399.               the line number is 8 bytes long.
  1400.  
  1401.  
  1402.            ______  ________ ___ ________ ___
  1403.            13,14.  Reserved for internal use
  1404.  
  1405.  
  1406.            _______  ______ _____ ___ _____ _____
  1407.            15-270.  Buffer space for Qedit files
  1408.  
  1409.  
  1410.     ________ _________
  1411.     Argument Parameter
  1412.  
  1413.            This is a general-purpose parameter.  In functions 1, 5, 9, 13 and
  1414.            15,  it  specifies the file name to be opened.  In functions 2, 8,
  1415.            and 17, it is the buffer for returning the record just  read.   In
  1416.            function  12,  it is the buffer containing the data to be written.
  1417.            In function 6, it is a line number in DOUBLE-INTEGER  format.   In
  1418.            functions  7,  14  and  16,  it  passes in the file number (single
  1419.            integer).  In function 18, it contains the error message  that  is
  1420.            returned.   For the other functions that doesn't use the Argument,
  1421.            a dummy parameter still must be passed.
  1422.  
  1423.  
  1424.     ______ _______ ________ _____ _____
  1425.     Pascal Example (Reading Qedit File)
  1426.  
  1427.            {
  1428.            This program demonstrates how to call Qeditaccess from
  1429.            Pascal.  It reads a Qedit file called QDATA and displays
  1430.            the contents of the file on $stdlist.
  1431.            }
  1432.            $HP3000_16$      { compiler option for Pascal/XL only }
  1433.  
  1434.            program TestQaccess( input,output );
  1435.  
  1436.            const
  1437.              MaxFnameLen = 40;
  1438.              MaxLineLen  = 256;
  1439.  
  1440.            type
  1441.              shortint = -32768..32767;
  1442.              {
  1443.              The type declaration for shortint is required in Pascal/V.
  1444.              Comment this line out in Pascal/XL.
  1445.              }
  1446.              {
  1447.              This is the general Argument parameter for Qeditaccess.
  1448.              The different uses are indicated by the variant fields.
  1449.              More variant fields can be added.
  1450.  
  1451.                                      _______ _   ___________ _________
  1452.                                      Chapter 4   Qeditaccess Procedure     23
  1453.  
  1454.  
  1455.  
  1456.              All of the parameters must be passed as 16-bit word
  1457.              addresses (e.g., the Argument parameter cannot simply be
  1458.              declared as a packed array of char)
  1459.  
  1460.              The case variant shortint MUST NOT be given a field name.
  1461.              }
  1462.              ArgRec = record
  1463.                case shortint of
  1464.                  1: (fname: packed array[1..MaxFnameLen] of char);
  1465.                  2: (line:  packed array[1..MaxLineLen] of char);
  1466.                end;
  1467.  
  1468.              WorkRec = record
  1469.                status      : shortint;
  1470.                filenum     : shortint;
  1471.                filetype    : shortint;
  1472.                lang        : shortint;
  1473.                length      : shortint;
  1474.                size_key    : integer;
  1475.                block       : shortint;
  1476.                index       : shortint;
  1477.                readlen     : shortint;
  1478.                left        : shortint;
  1479.                keylen      : shortint;
  1480.                reserved    : integer;
  1481.                buf         : packed array[1..256] of shortint;
  1482.              end;
  1483.  
  1484.              FuncRec = record
  1485.                num         : shortint;
  1486.                lang        : shortint;
  1487.                recsize     : shortint;
  1488.                numblocks   : shortint;
  1489.                numextents  : shortint;
  1490.                initextent  : shortint;
  1491.              end;
  1492.  
  1493.            var
  1494.              Func      : FuncRec;
  1495.              WorkSpace : WorkRec;
  1496.              Arg       : ArgRec;
  1497.  
  1498.              i         : shortint;
  1499.              done      : boolean;
  1500.  
  1501.            procedure QeditAccess( var func      : FuncRec;
  1502.                                   var workspace : WorkRec;
  1503.                                   var arg       : ArgRec );
  1504.              external spl;
  1505.  
  1506.            begin
  1507.              arg.fname := 'QDATA ';
  1508.              Func.num := 1;
  1509.              QeditAccess( Func, WorkSpace, Arg );
  1510.  
  1511.            _______ _   ___________ _________
  1512.     24     Chapter 4   Qeditaccess Procedure
  1513.  
  1514.  
  1515.  
  1516.              if WorkSpace.status<>0 then begin
  1517.                writeln('could not open, error = ', WorkSpace.status );
  1518.              end
  1519.  
  1520.              else begin
  1521.                done := false;
  1522.  
  1523.                repeat
  1524.                  Func.num:=2;
  1525.                  QeditAccess( Func, WorkSpace, Arg );
  1526.                  if WorkSpace.status=0 then begin
  1527.                    for i:=1 to WorkSpace.length do
  1528.                      write( Arg.line[i]);
  1529.                    writeln;
  1530.                  end
  1531.                  else if WorkSpace.status=-1 then    { end of file }
  1532.                    done := true
  1533.                  else begin
  1534.                    writeln('could not read, error = '
  1535.                            ,WorkSpace.status);
  1536.                    done := true;
  1537.                  end;
  1538.                until done;
  1539.  
  1540.                Func.num := 3;
  1541.                QeditAccess( Func, WorkSpace, Arg );
  1542.              end;
  1543.            end.
  1544.  
  1545.  
  1546.     ___ _______ ________ _____ _____
  1547.     SPL Example (Reading Qedit File)
  1548.  
  1549.            $control uslinit
  1550.            begin << Qcopytst program:  testing Qeditaccess routine.
  1551.                  Reads a Qedit file and prints it.
  1552.                  Prints attributes of file (recsize, cobol'ness).
  1553.                  Prints line 5.000 of file (or next line, if any).
  1554.                     :file input=xxxx
  1555.                     :run Qcopytst [;parm=1]
  1556.                  Use Parm=1 to ignore Sequence Numbers.  >>
  1557.               byte array fname(0:10):="INPUT ";
  1558.               integer filenum, filecode, readtype, parm=q-4;
  1559.               array linebuf(0:128);
  1560.               byte array linebuf'(*)=linebuf;
  1561.               double array linenumber (*)=linebuf;
  1562.               integer opencode:=1, readcode:=2, closecode:=3,
  1563.                       findcode:=6, already'open:=7, unn'read:=8;
  1564.               array workspace (0:269);
  1565.               integer array qstatus        (*) = workspace(0);
  1566.               integer array recsize        (*) = workspace(4);
  1567.               integer array readlen        (*) = workspace(9);
  1568.               logical array cobol'flag     (*) = workspace(10);
  1569.               double array curkey          (*) = workspace(5);
  1570.               procedure Qeditaccess (function,workspace,argument);
  1571.  
  1572.                                      _______ _   ___________ _________
  1573.                                      Chapter 4   Qeditaccess Procedure     25
  1574.  
  1575.  
  1576.  
  1577.                 integer function;
  1578.                 array workspace, argument;
  1579.                 option external, check 3;
  1580.               intrinsic print,ascii,fopen,fgetinfo,
  1581.                         fclose, printfileinfo;
  1582.  
  1583.               subroutine print'line'five;
  1584.               begin
  1585.                 linenumber := 5000d; <<5.000>>
  1586.                 Qeditaccess(findcode,workspace,linenumber);
  1587.                 if qstatus=0 then
  1588.                 begin
  1589.                   print(linebuf,-readlen,0);
  1590.                   if curkey <> 5000d then
  1591.                     print(linebuf,-(move linebuf':="Line after 5 ^ ")
  1592.                          ,0)
  1593.                   else
  1594.                     print(linebuf,-(move linebuf':="Line 5 ^ "),0);
  1595.                 end
  1596.                 else
  1597.                   print(linebuf,-(move linebuf':="No line 5!"),0);
  1598.               end; <<print'line'five>>
  1599.  
  1600.               subroutine print'attributes;
  1601.               begin
  1602.                 move linebuf:="Recsize=";
  1603.                 print(linebuf,-(8+ascii(recsize,10,linebuf'(8))),0);
  1604.                 if cobol'flag then
  1605.                   print(linebuf,-(move linebuf':="COBOL file."),0);
  1606.               end; << print'attributes >>
  1607.  
  1608.               logical subroutine open'Qedit'file;
  1609.               begin
  1610.                 filenum := fopen(fname,3);
  1611.                 if <> then
  1612.                   printfileinfo(filenum)
  1613.                 else
  1614.                 begin
  1615.                   fgetinfo(filenum,,,,,,,,filecode);
  1616.                   if <> or filecode<>111 then  !Ignore Keep files
  1617.                   begin ! Even though Qeditaccess can read them too!
  1618.                     print(linebuf,-(move linebuf':=
  1619.                        "Not a Qedit File"),0);
  1620.                     fclose(filenum,0,0);
  1621.                   end
  1622.                   else
  1623.                   begin
  1624.                     Qeditaccess(already'open,workspace,filenum);
  1625.                     if qstatus=0 then
  1626.                     begin
  1627.                       open'Qedit'file:=true;
  1628.                       print'attributes;
  1629.                     end
  1630.                     else
  1631.  
  1632.            _______ _   ___________ _________
  1633.     26     Chapter 4   Qeditaccess Procedure
  1634.  
  1635.  
  1636.  
  1637.                       fclose(filenum,0,0);
  1638.                   end;
  1639.                 end;
  1640.               end; <<open'Qedit'file>>
  1641.  
  1642.               readtype := if parm=1 then unn'read else readcode;
  1643.               if open'Qedit'file then
  1644.               begin
  1645.                 while qstatus = 0 do
  1646.                 begin
  1647.                   Qeditaccess(readtype,workspace,linebuf);
  1648.                   if qstatus=0 then
  1649.                     print(linebuf,-readlen,0);
  1650.                 end;
  1651.                 print'line'five;
  1652.                 Qeditaccess(closecode,workspace,linebuf);
  1653.               end;
  1654.            end.  <<Qcopytst>>
  1655.  
  1656.            ________
  1657.            Caution.   The WORKSPACE parameter is used by Qeditaccess to  hold
  1658.            important  control  variables  for  each  file  that is opened.  A
  1659.            separate  workspace  must  be  provided  for  each  file  and  the
  1660.            workspace must not be changed by the calling program.  Even though
  1661.            their lengths are the same, the workspace for Qeditaccess and  the
  1662.                                               ___
  1663.            workspace for the QOUT routines is not the same.  The two internal
  1664.            workspace definitions are completely different.
  1665.  
  1666.  
  1667.     _____ _______ __ _______ _____ __ ___
  1668.     COBOL Program to Convert Qedit to MPE
  1669.  
  1670.            Here is a  sample  COBOL/85  program  that  calls  QeditAccess  to
  1671.            convert  a  Qedit file to an MPE file.  It has been tested on both
  1672.            MPE V and MPE/iX (in CM and NM).
  1673.  
  1674.            $control uslinit
  1675.  
  1676.             id division.
  1677.             program-id.     qed2mpe.
  1678.  
  1679.            *    qed2mpe reads a qedit file and generates a mpe file.
  1680.            *    the mpe file is always 80 bytes fixed ascii.
  1681.            *    use a file command to define the file name and flimit
  1682.            *    e.g., :file out01=blabla;disc=25000
  1683.  
  1684.             environment division.
  1685.  
  1686.             input-output section.
  1687.  
  1688.             file-control.
  1689.                 select mpe-file assign to "OUT01".
  1690.  
  1691.             data division.
  1692.  
  1693.             file section.
  1694.  
  1695.                                      _______ _   ___________ _________
  1696.                                      Chapter 4   Qeditaccess Procedure     27
  1697.  
  1698.  
  1699.  
  1700.             fd  mpe-file
  1701.                 data record is mpe-record.
  1702.             01  mpe-record                          pic x(80).
  1703.  
  1704.             working-storage section.
  1705.  
  1706.             01  disp-s9-4                           pic +9(4).
  1707.             01  disp-s9-9                           pic +9(9).
  1708.             01  qedit-filename                      pic x(40).
  1709.             01  qedit-file-flag             pic x(1) value low-value.
  1710.                 88 qedit-file-is-open                value "O".
  1711.                 88 end-of-qedit-file                 value "E".
  1712.  
  1713.             01  qacc-function                       pic s9(4) comp.
  1714.             01  qacc-workspace                      pic x(540).
  1715.             01  filler redefines qacc-workspace.
  1716.                 05 qacc-status                      pic s9(4) comp.
  1717.                 05 qacc-filenum                     pic s9(4) comp.
  1718.                 05 qacc-type                        pic s9(4) comp.
  1719.                 05 qacc-lang                        pic s9(4) comp.
  1720.                 05 qacc-length                      pic s9(4) comp.
  1721.                 05 qacc-size                        pic s9(9) comp.
  1722.                 05 qacc-block                       pic s9(4) comp.
  1723.                 05 qacc-index                       pic s9(4) comp.
  1724.                 05 qacc-readlen                     pic s9(4) comp.
  1725.                 05 qacc-left                        pic s9(4) comp.
  1726.                 05 qacc-keylen                      pic s9(4) comp.
  1727.                 05 filler                           pic s9(4) comp.
  1728.                 05 filler                           pic s9(4) comp.
  1729.                 05 qacc-buffer                      pic x(512).
  1730.  
  1731.             01  dummy                               pic s9(4) comp.
  1732.             01  qedit-record                        pic x(256).
  1733.             01  read-counter                        pic s9(9) comp.
  1734.             01  write-counter                       pic s9(9) comp.
  1735.  
  1736.             procedure division.
  1737.  
  1738.             qed2mpe.
  1739.  
  1740.                 display "QED2MPE TEST PROGRAM"
  1741.                 display space
  1742.                 display "Enter Qedit file to read: " with no advancing
  1743.                 move spaces to qedit-filename
  1744.                 accept qedit-filename
  1745.                 if qedit-filename <> spaces then
  1746.                    open output mpe-file
  1747.                    perform open-qedit-file
  1748.                    if qedit-file-is-open then
  1749.                       move 0 to read-counter, write-counter
  1750.                       display "Info: Starting to read file"
  1751.                       perform read-qedit-file
  1752.                          until end-of-qedit-file
  1753.                       move read-counter to disp-s9-9
  1754.  
  1755.            _______ _   ___________ _________
  1756.     28     Chapter 4   Qeditaccess Procedure
  1757.  
  1758.  
  1759.  
  1760.                       display
  1761.                          "Info: read-counter = " disp-s9-9
  1762.                       move write-counter to disp-s9-9
  1763.                       display
  1764.                          "Info: write-counter = " disp-s9-9
  1765.                       perform close-qedit-file
  1766.                       end-if
  1767.                       close mpe-file
  1768.                    end-if
  1769.                 goback
  1770.                 .
  1771.  
  1772.  
  1773.             open-qedit-file.
  1774.  
  1775.                 move 1 to qacc-function
  1776.                 call "QEDITACCESS" using qacc-function,
  1777.                                          qacc-workspace,
  1778.                                          qedit-filename
  1779.                 if qacc-status = 0 then
  1780.                    if qacc-type = 1 then
  1781.                       perform display-qedit-file-info
  1782.                       move "O" to qedit-file-flag
  1783.                    else
  1784.                       move qacc-type to disp-s9-4
  1785.                       display
  1786.                          "Error: Not a Qedit file.  "
  1787.                          "qacc-type = " disp-s9-4
  1788.                 else
  1789.                    move qacc-status to disp-s9-4
  1790.                    display
  1791.                       "Error: Can't open file.  "
  1792.                       "qacc-status = " disp-s9-4
  1793.                 .
  1794.  
  1795.  
  1796.             display-qedit-file-info.
  1797.  
  1798.                 move qacc-filenum to disp-s9-4
  1799.                 display "Info: filenum = " disp-s9-4
  1800.                 move qacc-type to disp-s9-4
  1801.                 display "Info: type = " disp-s9-4
  1802.                 move qacc-lang to disp-s9-4
  1803.                 display "Info: lang = " disp-s9-4
  1804.                 move qacc-length to disp-s9-4
  1805.                 display "Info: length = " disp-s9-4
  1806.                 move qacc-size to disp-s9-9
  1807.                 display "Info: size = " disp-s9-9
  1808.                 move qacc-block to disp-s9-4
  1809.                 display "Info: block = " disp-s9-4
  1810.                 move qacc-index to disp-s9-4
  1811.                 display "Info: index = " disp-s9-4
  1812.                 move qacc-readlen to disp-s9-4
  1813.                 display "Info: readlen = " disp-s9-4
  1814.  
  1815.                                      _______ _   ___________ _________
  1816.                                      Chapter 4   Qeditaccess Procedure     29
  1817.  
  1818.  
  1819.  
  1820.                 move qacc-left to disp-s9-4
  1821.                 display "Info: left = " disp-s9-4
  1822.                 move qacc-keylen to disp-s9-4
  1823.                 display "Info: keylen = " disp-s9-4
  1824.                 .
  1825.  
  1826.  
  1827.             read-qedit-file.
  1828.  
  1829.                 move 2 to qacc-function
  1830.                 call "QEDITACCESS" using qacc-function,
  1831.                                          qacc-workspace,
  1832.                                          qedit-record
  1833.                 if qacc-status = 0 then
  1834.                    add 1 to read-counter
  1835.                    perform write-mpe-record
  1836.                 else
  1837.                    if qacc-status = -1 then
  1838.                       move "E" to qedit-file-flag
  1839.                    else
  1840.                       move qacc-status to disp-s9-4
  1841.                       display
  1842.                          "Error: Read returned unexpected status.  "
  1843.                          "qacc-status = " disp-s9-4
  1844.                 .
  1845.  
  1846.  
  1847.             write-mpe-record.
  1848.  
  1849.                 write mpe-record from qedit-record
  1850.                 add 1 to write-counter
  1851.                 .
  1852.  
  1853.  
  1854.             close-qedit-file.
  1855.  
  1856.                 move 3 to qacc-function
  1857.                 call "QEDITACCESS" using qacc-function,
  1858.                                          qacc-workspace,
  1859.                                          qedit-record
  1860.                 if qacc-status = 0 then
  1861.                    move low-values to qedit-file-flag
  1862.                 else
  1863.                    move qacc-status to disp-s9-4
  1864.                    display
  1865.                       "Error: Can't close file.  "
  1866.                       "qacc-status = " disp-s9-4
  1867.                 .
  1868.  
  1869.            _______ _   ___________ _________
  1870.     30     Chapter 4   Qeditaccess Procedure
  1871.  
  1872.  
  1873.  
  1874.     _____ _______ __ _______ ___ __ _____
  1875.     COBOL Program to Convert MPE to Qedit
  1876.  
  1877.            Here is a  sample  COBOL/85  program  that  calls  QeditAccess  to
  1878.            convert  an  MPE file to a Qedit file.  It has been tested on both
  1879.            MPE V and MPE/iX (in CM and NM).
  1880.  
  1881.            $control uslinit
  1882.  
  1883.             id division.
  1884.             program-id.     mpe2qed.
  1885.  
  1886.            *    mpe2qed reads a mpe file and generates a qedit file.
  1887.            *    The mpe file must be a 80B FA file.  The qedit file
  1888.            *    will be created as a lang=job file with 400 blocks.
  1889.            *    Use a file command to define the input file name.
  1890.            *    E.g., :file in01=filename
  1891.  
  1892.             environment division.
  1893.  
  1894.             input-output section.
  1895.  
  1896.             file-control.
  1897.                 select mpe-file assign to "IN01".
  1898.  
  1899.             data division.
  1900.  
  1901.             file section.
  1902.  
  1903.             fd  mpe-file
  1904.                 data record is mpe-record.
  1905.             01  mpe-record                          pic x(80).
  1906.  
  1907.             working-storage section.
  1908.  
  1909.             01  disp-s9-4                           pic +9(4).
  1910.             01  disp-s9-9                           pic +9(9).
  1911.             01  qedit-filename                      pic x(40).
  1912.             01  mpe-file-flag               pic x(1) value low-value.
  1913.                 88 mpe-file-is-open                  value "O".
  1914.                 88 end-of-mpe-file                   value "E".
  1915.             01  qedit-file-flag             pic x(1) value low-value.
  1916.                 88 qedit-file-is-open                value "O".
  1917.                 88 end-of-qedit-file                 value "E".
  1918.  
  1919.             01  qacc-function.
  1920.                 05 qacc-func                        pic s9(4) comp
  1921.                                                     occurs 10 times.
  1922.             01  qacc-workspace                      pic x(540).
  1923.             01  filler redefines qacc-workspace.
  1924.                 05 qacc-status                      pic s9(4) comp.
  1925.                 05 qacc-filenum                     pic s9(4) comp.
  1926.                 05 qacc-type                        pic s9(4) comp.
  1927.                 05 qacc-lang                        pic s9(4) comp.
  1928.                 05 qacc-length                      pic s9(4) comp.
  1929.  
  1930.                                      _______ _   ___________ _________
  1931.                                      Chapter 4   Qeditaccess Procedure     31
  1932.  
  1933.  
  1934.  
  1935.                 05 qacc-size                        pic s9(9) comp.
  1936.                 05 qacc-block                       pic s9(4) comp.
  1937.                 05 qacc-index                       pic s9(4) comp.
  1938.                 05 qacc-readlen                     pic s9(4) comp.
  1939.                 05 qacc-left                        pic s9(4) comp.
  1940.                 05 qacc-keylen                      pic s9(4) comp.
  1941.                 05 filler                           pic s9(4) comp.
  1942.                 05 filler                           pic s9(4) comp.
  1943.                 05 qacc-buffer                      pic x(512).
  1944.  
  1945.             01  dummy                               pic s9(4) comp.
  1946.             01  qedit-record                        pic x(256).
  1947.             01  write-counter                       pic s9(9) comp.
  1948.             01  read-counter                        pic s9(9) comp.
  1949.  
  1950.             procedure division.
  1951.  
  1952.             mpe2qed.
  1953.  
  1954.                 display "MPE2QED TEST PROGRAM"
  1955.                 display space
  1956.                 display "Enter Qedit file to create: "
  1957.                     with no advancing
  1958.                 move spaces to qedit-filename
  1959.                 accept qedit-filename
  1960.                 if qedit-filename <> spaces then
  1961.                    open input mpe-file
  1962.                    perform open-qedit-file
  1963.                    if qedit-file-is-open then
  1964.                       move 0 to write-counter, read-counter
  1965.                       move 12 to qacc-func (1)
  1966.                       move 80 to qacc-func (2)
  1967.                       move 0 to qacc-func (3)
  1968.                       move 0 to qacc-func (4)
  1969.                       display "Info: Starting to write records"
  1970.                       perform read-mpe-record
  1971.                          until end-of-mpe-file
  1972.                       move read-counter to disp-s9-9
  1973.                       display
  1974.                          "Info: read-counter = " disp-s9-9
  1975.                       move write-counter to disp-s9-9
  1976.                       display
  1977.                          "Info: write-counter = " disp-s9-9
  1978.                       perform close-qedit-file
  1979.                       end-if
  1980.                    close mpe-file
  1981.                    end-if
  1982.                 goback
  1983.                 .
  1984.  
  1985.  
  1986.             open-qedit-file.
  1987.  
  1988.                 move 9 to qacc-func (1)
  1989.  
  1990.            _______ _   ___________ _________
  1991.     32     Chapter 4   Qeditaccess Procedure
  1992.  
  1993.  
  1994.  
  1995.                 move 5 to qacc-func (2)
  1996.                 move 80 to qacc-func (3)
  1997.                 move 400 to qacc-func (4)
  1998.                 move 32 to qacc-func (5)
  1999.                 move 1 to qacc-func (6)
  2000.  
  2001.                 call "QEDITACCESS" using qacc-function,
  2002.                                          qacc-workspace,
  2003.                                          qedit-filename
  2004.                 if qacc-status = 0 then
  2005.                    move "O" to qedit-file-flag
  2006.                 else
  2007.                    move qacc-status to disp-s9-4
  2008.                    display
  2009.                       "Error: Can't open file.  "
  2010.                       "qacc-status = " disp-s9-4
  2011.                 .
  2012.  
  2013.  
  2014.             display-qedit-file-info.
  2015.  
  2016.                 move qacc-filenum to disp-s9-4
  2017.                 display "Info: filenum = " disp-s9-4
  2018.                 move qacc-type to disp-s9-4
  2019.                 display "Info: type = " disp-s9-4
  2020.                 move qacc-lang to disp-s9-4
  2021.                 display "Info: lang = " disp-s9-4
  2022.                 move qacc-length to disp-s9-4
  2023.                 display "Info: length = " disp-s9-4
  2024.                 move qacc-size to disp-s9-9
  2025.                 display "Info: size = " disp-s9-9
  2026.                 move qacc-block to disp-s9-4
  2027.                 display "Info: block = " disp-s9-4
  2028.                 move qacc-index to disp-s9-4
  2029.                 display "Info: index = " disp-s9-4
  2030.                 move qacc-readlen to disp-s9-4
  2031.                 display "Info: readlen = " disp-s9-4
  2032.                 move qacc-left to disp-s9-4
  2033.                 display "Info: left = " disp-s9-4
  2034.                 move qacc-keylen to disp-s9-4
  2035.                 display "Info: keylen = " disp-s9-4
  2036.                 .
  2037.             read-mpe-record.
  2038.  
  2039.                 read mpe-file into qedit-record
  2040.                    at end move "E" to mpe-file-flag.
  2041.                 if not end-of-mpe-file then
  2042.                    add 1 to read-counter
  2043.                    perform write-qedit-record
  2044.                    .
  2045.  
  2046.  
  2047.             write-qedit-record.
  2048.  
  2049.                                      _______ _   ___________ _________
  2050.                                      Chapter 4   Qeditaccess Procedure     33
  2051.  
  2052.  
  2053.  
  2054.                 call "QEDITACCESS" using qacc-function,
  2055.                                          qacc-workspace,
  2056.                                          qedit-record
  2057.                 if qacc-status = 0 then
  2058.                    add 1 to write-counter
  2059.                 else
  2060.                    move qacc-status to disp-s9-4
  2061.                    display
  2062.                       "Error: Can't write record.  "
  2063.                       "qacc-status = " disp-s9-4
  2064.                 .
  2065.  
  2066.  
  2067.             close-qedit-file.
  2068.  
  2069.                 move 10 to qacc-func (1)
  2070.                 call "QEDITACCESS" using qacc-function,
  2071.                                          qacc-workspace,
  2072.                                          qedit-record
  2073.                 if qacc-status = 0 then
  2074.                    move low-values to qedit-file-flag
  2075.                 else
  2076.                    move qacc-status to disp-s9-4
  2077.                    display
  2078.                       "Error: Can't close file.  "
  2079.                       "qacc-status = " disp-s9-4
  2080.                 .
  2081.  
  2082.     34
  2083.  
  2084.  
  2085.  
  2086.  
  2087.     _______ _   ____________ __ _____
  2088.     Chapter 5   Installation of Qcopy
  2089.  
  2090.  
  2091.                 _  ___________ ___________ __ __
  2092.                 *  Integrating Qeditaccess in CM
  2093.                 _  ___________ ___________ __ __
  2094.                 *  Integrating Qeditaccess in NM
  2095.  
  2096.  
  2097.            Qcopy is distributed in the QLIB groups of  the  Robelle  account.
  2098.            To  install Qcopy, you must first build the ROBELLE account, using
  2099.            the robelle.pub.sys job file,  then  :RESTORE  the  files  needed.
  2100.            Here are the steps to follow:
  2101.  
  2102.                 :hello mgr.robelle
  2103.                 :file qtape;dev=tape
  2104.                 :restore *qtape;Qcopy@.qlib@,prose.qlib,&
  2105.                 :Qacc@.qlib,qaccess.qlibsrc;show
  2106.  
  2107.            We  include  two  copies  of  the  Qcopy  program:  Qcopy.Qlib and
  2108.            QcopyNM.Qlib, which is a native-mode version for  MPE/iX  systems.
  2109.            To  install  the  native-mode  version  of Qcopy as the production
  2110.            version, use these commands:
  2111.  
  2112.                 :hello mgr.robelle,qlib
  2113.                 :rename qcopy,qcopycm
  2114.                 :rename qcopynm,qcopy
  2115.  
  2116.            Here are the steps to print the user manual:
  2117.  
  2118.                 :file infile=qcopy.qlibdoc.robelle
  2119.                                      ______
  2120.                 :file output;dev=lp,,copies
  2121.                 :run prose.qlib.robelle
  2122.  
  2123.            The source code for Qeditaccess will be found in  qaccess.qlibsrc.
  2124.            robelle.   The  file Qaccusl.qlib.robelle contains the object code
  2125.            in MPE V (USL) format; the file Qaccobj.qlib.robelle contains  the
  2126.            MPE/iX object code.
  2127.  
  2128.  
  2129.     ___________ ___________ __ __
  2130.     Integrating Qeditaccess in CM
  2131.  
  2132.            Here  are  the steps to use the Segmenter to copy Qeditaccess into
  2133.            one of your CM programs:
  2134.  
  2135.                 :hello user.account
  2136.                 :cobol myprog.source
  2137.                 :segmenter
  2138.                 -usl $oldpass
  2139.                 -auxusl qaccusl.qlib.robelle
  2140.                 -copy unit,Qeditaccess
  2141.                 -prep myprog.program;cap=...
  2142.                 -exit
  2143.                 :save myprog.program
  2144.  
  2145.                                      _______ _   ____________ __ _____
  2146.                                      Chapter 5   Installation of Qcopy     35
  2147.  
  2148.  
  2149.  
  2150.     ___________ ___________ __ __
  2151.     Integrating Qeditaccess in NM
  2152.  
  2153.            Use the Qaccobj file to copy the Qeditaccess object code into your
  2154.            linked NM program file:
  2155.  
  2156.                 link from=objfile,qaccobj.qlib.robelle;to=progfile
  2157.  
  2158.            If  you have a large number of programs that call Qeditaccess, you
  2159.            may prefer to put the object code in  a  single  XL  file,  making
  2160.            updates much easier:
  2161.  
  2162.                 :linkedit
  2163.                 -addxl from=qaccobj.qlib.robelle;to=myxl
  2164.                 -exit
  2165.  
  2166.                                                                            36
  2167.  
  2168.  
  2169.  
  2170.                       _____
  2171.                       Index
  2172.  
  2173.  
  2174.  
  2175.  
  2176.                       _
  2177.                       A
  2178.  
  2179.                       already open write, function 14....16
  2180.                       already open write, function 16....17
  2181.                       already open, function 7...........15
  2182.                       anysize already open, function 31..18
  2183.                       anysize open serial, function 32...18
  2184.                       APPEND option......................7
  2185.                       argument parameter.................22
  2186.  
  2187.  
  2188.                       _
  2189.                       B
  2190.  
  2191.                       batch..............................3
  2192.  
  2193.  
  2194.                       _
  2195.                       C
  2196.  
  2197.                       close permanent, function 10.......15
  2198.                       close read, function 3.............14
  2199.                       close temporary, function 11.......16
  2200.                       CM installation....................34
  2201.                       command options....................6
  2202.                       control-y..........................5,6
  2203.                       convert a file on to itself........5,8
  2204.                       convert Keep to new Qedit..........9
  2205.                       convert Qedit to existing Keep.....8
  2206.                       convert Qedit to new Keep..........8
  2207.                       copying a group of files...........5
  2208.                       copying files......................5
  2209.                       creating Qedit files...............7
  2210.  
  2211.  
  2212.                       _
  2213.                       D
  2214.  
  2215.                       don't suspend on exit..............4
  2216.  
  2217.  
  2218.                       _
  2219.                       E
  2220.  
  2221.                       ERASE option.......................7
  2222.                       explain, function 18...............18
  2223.  
  2224.  
  2225.                       _
  2226.                       F
  2227.  
  2228.                       file number, workspace.............20
  2229.                       file size, workspace...............21
  2230.                       file type, workspace...............20
  2231.  
  2232.            _____
  2233.     37     Index
  2234.  
  2235.  
  2236.  
  2237.                       find line number, function 6.......14
  2238.                       From= command......................5
  2239.                       FTN option.........................8
  2240.                       function 1, open read..............13
  2241.                       function 10, close permanent.......15
  2242.                       function 11, close temporary.......16
  2243.                       function 12, write line............16
  2244.                       function 13, open write erase......16
  2245.                       function 14, already open write....16
  2246.                       function 15, open write append.....17
  2247.                       function 16, already open write....17
  2248.                       function 17, read line.............17
  2249.                       function 18, explain...............18
  2250.                       function 2, read next record.......14
  2251.                       function 3, close read.............14
  2252.                       function 30, open anysize read.....18
  2253.                       function 31, anysize already open..18
  2254.                       function 32, anysize serial open...18
  2255.                       function 4, rewind.................14
  2256.                       function 5, serial open............14
  2257.                       function 6, find line number.......14
  2258.                       function 7, already open...........15
  2259.                       function 8, read unnumbered........15
  2260.                       function 9, open new...............15
  2261.                       function parameter.................13
  2262.                       function summary...................13
  2263.  
  2264.  
  2265.                       _
  2266.                       G
  2267.  
  2268.                       group conversion of files..........5
  2269.  
  2270.  
  2271.                       _
  2272.                       H
  2273.  
  2274.                       help...............................3
  2275.                       Help command.......................3
  2276.                       HPDESK.............................3
  2277.  
  2278.  
  2279.                       _
  2280.                       I
  2281.  
  2282.                       INCLUDE files......................7
  2283.                       INCLUDE option.....................6,7
  2284.                       installation.......................34
  2285.                       introduction.......................1
  2286.  
  2287.  
  2288.                       _
  2289.                       K
  2290.  
  2291.                       key length, workspace..............22
  2292.  
  2293.                                                                  _____
  2294.                                                                  Index     38
  2295.  
  2296.  
  2297.  
  2298.                       _
  2299.                       L
  2300.  
  2301.                       language, workspace................20
  2302.                       left flag, workspace...............21
  2303.                       length of line number..............22
  2304.                       line number, workspace.............21
  2305.                       line numbers.......................5
  2306.  
  2307.  
  2308.                       _
  2309.                       M
  2310.  
  2311.                       MPE commands.......................2
  2312.  
  2313.  
  2314.                       _
  2315.                       N
  2316.  
  2317.                       native-mode........................3,34
  2318.                       New features of Qcopy..............1
  2319.                       NEW option.........................6
  2320.                       NM installation....................35
  2321.                       NMRL.Qlib.Robelle file.............35
  2322.  
  2323.  
  2324.                       _
  2325.                       O
  2326.  
  2327.                       open anysize read, function 30.....18
  2328.                       open new, function 9...............15
  2329.                       open read, function 1..............13
  2330.                       open serial, function 5............14
  2331.                       open write append, function 15.....17
  2332.                       open write erase, function 13......16
  2333.                       options in commands................6
  2334.                       overwriting workfile...............7
  2335.  
  2336.  
  2337.                       _
  2338.                       P
  2339.  
  2340.                       Parm=32............................4
  2341.                       PAS option.........................8
  2342.                       Pascal/Robelle callers.............12
  2343.                       position of line number............21
  2344.  
  2345.  
  2346.                       _
  2347.                       Q
  2348.  
  2349.                       QACCESS entry point................12
  2350.                       Qaccusl.Qlib.Robelle file..........34
  2351.                       Qcopy program......................3,34
  2352.                       Qcopynm............................3,34
  2353.                       qedit block, workspace.............21
  2354.                       qedit index, workspace.............21
  2355.                       QEDIT option.......................7
  2356.                       Qedit program......................1
  2357.                       Qeditaccess routine................1,12
  2358.  
  2359.            _____
  2360.     39     Index
  2361.  
  2362.  
  2363.  
  2364.                       _
  2365.                       R
  2366.  
  2367.                       read length, workspace.............21
  2368.                       read line, function 17.............17
  2369.                       read next record, function 2.......14
  2370.                       read unnumbered, function 8........15
  2371.                       read, no line numbers, function 17.17
  2372.                       reading Qedit files................12
  2373.                       recovering Qedit files.............10
  2374.                       recsize, workspace.................21
  2375.                       rewind, function 4.................14
  2376.  
  2377.  
  2378.                       _
  2379.                       S
  2380.  
  2381.                       save permanent file, function 10...15
  2382.                       save temporary file, function 11...16
  2383.                       serial open anysize, function 32...18
  2384.                       serial open, function 5............14
  2385.                       SERIAL option......................10
  2386.                       status, workspace..................19
  2387.                       suspending Qcopy...................4
  2388.  
  2389.  
  2390.                       _
  2391.                       U
  2392.  
  2393.                       UNN option.........................7
  2394.                       unnumbered.........................7
  2395.  
  2396.  
  2397.                       _
  2398.                       W
  2399.  
  2400.                       workspace of Qeditaccess...........18
  2401.                       workspace summary..................19
  2402.                       write line, function 12............16
  2403.                       writing to Qedit file..............16
  2404.  
  2405.  
  2406.                       _
  2407.                       X
  2408.  
  2409.                       XL.Qlib.Robelle file...............35
  2410.  
  2411.  
  2412.  
  2413.                                   ______ _______ _____
  2414.                                   Reader Comment Sheet
  2415.  
  2416.                                  _____ ___ ____ ______
  2417.                                  QCOPY 4.7 User Manual
  2418.  
  2419.            Your  opinion of this manual is a valuable resource for helping us
  2420.            improve the quality of our documentation.  We invite you  to  rate
  2421.            the manual in the areas shown below.
  2422.  
  2423.            ______ ______ ___ ______ ___ _____
  2424.            Please circle one number for each:
  2425.  
  2426.                                              ____      _______   ____
  2427.                                              Good      Average   Poor
  2428.  
  2429.            *  General organization             1         2         3
  2430.  
  2431.            *  Technical accuracy               1         2         3
  2432.  
  2433.            *  Writing clarity                  1         2         3
  2434.  
  2435.            *  Convenience of size and format   1         2         3
  2436.  
  2437.            *  Ease of locating information     1         2         3
  2438.  
  2439.            *  Thoroughness of material         1         2         3
  2440.  
  2441.            *  Quality of examples              1         2         3
  2442.  
  2443.  
  2444.            ________ ___ ____________   _______  ___  ________  __  __________
  2445.            Comments and suggestions:   (please  use  reverse,  or  additional
  2446.                                        ______ __ _______
  2447.                                        sheets as needed)
  2448.  
  2449.            _______________________________________________________________
  2450.                                                                           
  2451.  
  2452.            _______________________________________________________________
  2453.                                                                           
  2454.  
  2455.            _______________________________________________________________
  2456.                                                                           
  2457.  
  2458.            _______________________________________________________________
  2459.                                                                           
  2460.  
  2461.            _______________________________________________________________
  2462.                                                                           
  2463.  
  2464.            _______________________________________________________________
  2465.                                                                           
  2466.  
  2467.            Thank  you  for  your  feedback.   We  appreciate  your  time  and
  2468.            interest.  You may fax your comments to us at 1.888.robelle.
  2469.  
  2470.            Name:                                 Date:
  2471.  
  2472.            Company:                              Position:
  2473.  
  2474.            Address:                              Phone:
  2475.  
  2476.                                                                           iii
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.                                                            _____ ____ ______
  2492.                                                            QCOPY User Manual
  2493.  
  2494.  
  2495.  
  2496.  
  2497.                                                                     ________
  2498.                                                                     Contents
  2499.  
  2500.  
  2501.  
  2502.                          _______ _   _______ __ _____
  2503.                          Chapter 1   Welcome to Qcopy
  2504.  
  2505.                                     New features of Qcopy.................1
  2506.                                     New features of Qcopy.................1
  2507.                                     New features of Qcopy.................2
  2508.                                     Overview of Qcopy.....................2
  2509.                                     How to run Qcopy......................3
  2510.                                     Suspending Qcopy......................3
  2511.  
  2512.                          _______ _   _______ _____
  2513.                          Chapter 2   Copying Files
  2514.  
  2515.                                     Copying groups of files...............5
  2516.                                     Options...............................6
  2517.                                     Examples..............................8
  2518.  
  2519.                          _______ _   ________ _____ ___ ______ ______
  2520.                          Chapter 3   Recovery Using the SERIAL Option
  2521.  
  2522.                                     Introduction..........................10
  2523.                                     Examples..............................10
  2524.  
  2525.                          _______ _   ___________ _________
  2526.                          Chapter 4   Qeditaccess Procedure
  2527.  
  2528.                                     Introduction..........................12
  2529.                                     Function parameter....................13
  2530.                                     Workspace parameter...................18
  2531.                                     Argument parameter....................22
  2532.                                     Pascal example (reading Qedit file)...22
  2533.                                     SPL example (reading Qedit file)......24
  2534.                                     COBOL program to convert Qedit to MPE.26
  2535.                                     COBOL program to convert MPE to Qedit.30
  2536.  
  2537.            ________
  2538.     iv     Contents
  2539.  
  2540.  
  2541.  
  2542.                          _______ _   ____________ __ _____
  2543.                          Chapter 5   Installation of Qcopy
  2544.  
  2545.                                     Integrating Qeditaccess in CM.........34
  2546.                                     Integrating Qeditaccess in NM.........35
  2547.  
  2548.                          _____
  2549.                          Index............................................36
  2550.  
  2551.