HP 3000 Manuals

Migration Examples [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

Migration Examples 

This section contains several examples of the typical kinds of migration
changes.

Data File Real Number Conversion 

The following program shows the conversion of real numbers from the MPE V
format to the MPE/iX standard format.  Note that the HP3000_16 option is
applied to the input file and the HP3000_32 option is applied to the
output file.  This causes item-name R4, which is a real number, to be
read as an MPE V format real number and to be written as an MPE/iX
standard format real number.

     SYSTEM CONVRT,FILE=IN(READ(HP3000_16))
                  ,FILE=OUT(WRITE(HP3000_32));
     DEFINE(ITEM) X2 X(2):
                  I4 I(4):
                  I8 I(8):
                  R4 R(4);

     LIST X2:I4:I8:R4;

     FIND(SERIAL) IN,PERFORM=100-CONVERT;
     EXIT;

     100-CONVERT:
       PUT OUT;
       RETURN;

Procedures with Null 32 Bit Parameters 

The following fragment of Transact/V code illustrates the Transact/V
convention of two commas to indicate a null 32-bit parameter.

     SYSTEM EXAM1;

     DEFINE(ITEM) FILE-NAME X(20):
                  FOPTION   I(4):
                  AOPTION   I(4):
                  FILENUM   I(4):
                  BITMAP    I(4);

     DEFINE(INTRINSIC) FOPEN;

     LIST FILE-NAME:
          FOPTION:
          AOPTION:
          FILENUM:
          BITMAP;

     MOVE (FILE-NAME) = "OLDFILE";
     LET (FOPTION) = 5;                       <<old ascii file>>
     LET (AOPTION) = 0;                       <<read access>>
     LET (BITMAP) = 7168;                     <<1110000000000 passing the first>>
                                              <<three parameters               >>
     PROC FOPEN(%(FILE-NAME),
                #(FOPTION),
                #(AOPTION),
                ,,,,,,,,,,,                   <<note extra commas to denote null>>
                &(FILENUM),                   <<values                          >>
                #(BITMAP));

To modify this source program so that it is still compatible with
Transact/V, you must pass the filesize parameter and replace the two
commas currently used to denote a null filesize with the filesize
parameter and a single comma.  The code fragment for this is shown below.

     SYSTEM EXAM1;

     DEFINE(ITEM) FILE-NAME X(20):
                  FOPTION   I(4):
                  AOPTION   I(4):
                  FILENUM   I(4):
                  FILESIZE  I(9):              <<32 bit integer>>
                  BITMAP    I(4);

     DEFINE(INTRINSIC) FOPEN;

     LIST FILE-NAME:
          FOPTION:
          AOPTION:
          FILENUM:
          FILESIZE,INIT:
          BITMAP;

     MOVE (FILE-NAME) = "OLDFILE";
     LET (FOPTION) = 5;                        <<old ascii file>>
     LET (AOPTION) = 0;                        <<read access>>
     LET (BITMAP) = 7176;                      <<1110000001000 passing the first   >>
                                               <<three parameters and filesize     >>

     LET (FILESIZE) = 1023;
     PROC FOPEN(%(FILE-NAME),
                #(FOPTION),
                #(AOPTION),
                ,,,,,,
                #(FILESIZE)
                ,,,,                           <<each comma denotes a parameter;    >>
                &(FILENUM),                    <<note that there is 1 fewer comma   >>
                #(BITMAP));                    <<then there is in the above example.>>



MPE/iX 5.0 Documentation