Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example PL1 Using RECORD_ID_ACCESS To Get And Use Record RFA's
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1989. All rights reserved
LAYERED PRODUCT: PL1 V3.2     OP/SYS: VMS V5.N

SOURCE:     Digital Customer Support Center



OVERVIEW:

This procedure demonstrates using the RECORD_ID_ACCESS environment option
with an indexed file to retrieve and use the record RFAs.


PROCEDURE:

$!
$!  This command procedure:
$!
$!    1 - Compiles and links the PL/I program,
$!    2 - Creates an indexed file with 2 keys using an fdl definition
$!        since PL/I cannot create indexed files directly.
$!  The program is then executed which:
$!    1 - Writes records to the file, storing the record id's, then
$!    2 - Reads the file using those record id's.
$!
$ pli/obj=recid sys$input
rd:     procedure options(main);

    dcl keyfile keyed sequential file;
    dcl 1 record,
            2 prikey character(2),
            2 altkey character(2),
            2 data   character(10);
    dcl i fixed bin(31);
    dcl save(2) fixed bin(31);
    dcl save_id(5,2) fixed bin(31);

    open file(keyfile) update title('index.idx')
         environment(indexed, index_number(0), record_id_access);

    do i = 1 to 5;
      prikey = encode(i+10,10); altkey = encode(i+20,10); data = 'SOME DATA ';
      write file(keyfile) from(record) keyfrom(prikey)
            options(record_id_to(save));
      save_id(i,1) = save(1);
      save_id(i,2) = save(2);
    end;

    close file(keyfile);

    open file(keyfile) input title('index.idx')
         environment(indexed, index_number(0), record_id_access);

    do i = 5 to 1 BY -1;
       save(1) = save_id(i,1);
       save(2) = save_id(i,2);
       read file(keyfile) into(record) options(record_id(save));
       put skip list('pri: ',prikey,' alt: ',altkey,' data: ',data);
    end;

    close file(keyfile);

    end rd;
$ link recid
$!------------------------------------------------
$ crea idx2.fdl
TITLE   "Test FDL for 2-keyed indexed file"

IDENT   " 5-APR-1989 16:23:32   VAX-11 FDL Editor"

SYSTEM
        SOURCE                  "VAX/VMS"

FILE
        ORGANIZATION            indexed

RECORD
        CARRIAGE_CONTROL        carriage_return
        FORMAT                  variable
        SIZE                    14

AREA 0
        ALLOCATION              6
        BEST_TRY_CONTIGUOUS     yes
        BUCKET_SIZE             1
        EXTENSION               1

AREA 1
        ALLOCATION              3
        BEST_TRY_CONTIGUOUS     yes
        BUCKET_SIZE             1
        EXTENSION               1

AREA 2
        ALLOCATION              6
        BEST_TRY_CONTIGUOUS     yes
        BUCKET_SIZE             1
        EXTENSION               2

KEY 0
        CHANGES                 no
        DATA_AREA               0
        DATA_FILL               100
        DATA_KEY_COMPRESSION    no
        DATA_RECORD_COMPRESSION no
        DUPLICATES              no
        INDEX_AREA              1
        INDEX_COMPRESSION       no
        INDEX_FILL              100
        LEVEL1_INDEX_AREA       1
        PROLOG                  3
        SEG0_LENGTH             2
        SEG0_POSITION           0
        TYPE                    string

KEY 1
        CHANGES                 yes
        DATA_AREA               2
        DATA_FILL               100
        DATA_KEY_COMPRESSION    no
        DUPLICATES              no
        INDEX_AREA              2
        INDEX_COMPRESSION       no
        INDEX_FILL              100
        LEVEL1_INDEX_AREA       2
        SEG0_LENGTH             2
        SEG0_POSITION           2
        TYPE                    string
$ create/fdl=idx2 index.idx                     ! now create the null file
$ run recid                                     ! and run the program.
$ exit




buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms