USER 'XYZ COMPANY, INC.'
PERSONEL: INPUT DATACOM RECORD EQ 375 NAME EQ PMF DBID EQ 001
DEFINE PERSONEL-COMMAND 001-005 X
DEFINE PERSONEL-KEY 006-010 X
DEFINE PERSONEL-ELMLIST 191-201 X
DEFINE PERSONEL-NUMBER 301-305 X ' ID ' 'NUMBER'
DEFINE PERSONEL-NAME 306-329 X 'EMPLOYEE NAME'
DEFINE PERSONEL-CITY 354-368 X 'CITY'
DEFINE PERSONEL-STATE 369-370 X
DEFINE PERSONEL-ZIP-CODE 371-375 X 'ZIP' 'CODE'
MOVE 'GETIT' TO PERSONEL-COMMAND
MOVE 'EMPNO' TO PERSONEL-KEY
MOVE 'ADEMP' TO PERSONEL-ELMLIST
GET PERSONEL
GOTO EOJ WHEN PERSONEL EQ 'E'
REPORT 'EMPLOYEE SUMMARY - TEXAS'
SELECT PERSONEL-STATE EQ 'TX'
CONTROL PERSONEL-CITY
PRINT PERSONEL-NAME PERSONEL-NUMBER PERSONEL-CITY
PERSONEL-ZIP-CODE
END
MOVE statements are coded after the DEFINE statements if you are working with CA Datacom/DB. The MOVE statements move literal strings to fields within the Communications Area.
The literal strings in the sample program are the appropriate CA Datacom/DB command, key name, and list that had locations assigned to them in the Communications Area.
If this program were accessing a non-CA Datacom/DB file, the DEFINE statements would be followed by a GET statement. In the sample program, however, the MOVE statement must come before the GET statement. You cannot tell the Reporting Facility to start processing records (GET) if the CA Datacom/DB command, key name, and element have not already been moved (MOVE) to the locations assigned them. The CA Datacom/DB command, key name, and element contain information vital to processing the table.
Code the general MOVE command in the following format:
►►─ MOVE ─ 'literal-string' ─ TO ─ fieldname ─────────────────────────────────►◄
In the first MOVE statement of the sample program, code the word MOVE as shown. PERSONEL-COMMAND is the user-supplied name of the five-character field where the literal string will be moved.
MOVE 'GETIT' TO PERSONEL-COMMAND MOVE 'EMPNO' TO PERSONEL-KEY MOVE 'ADEMP' TO PERSONEL-ELMLIST
Code the literal string first, then the keyword TO followed by the field name. The CA Datacom/DB command GETIT is the literal string, and must be enclosed by apostrophes. The GETIT command indicates that the table will be searched sequentially, starting with the first record in the table.
The first MOVE statement in the sample program tells the Reporting Facility to move a literal string GETIT, which represents the CA Datacom/DB READ command, to the field named PERSONEL-COMMAND.
The GETIT command specifies that CA Datacom/DB is to read the table in sequential order. Also available is a table positioning command, GSETL, that indicates a starting point for the first read of the table. When the command specified during the first read of the table is the GETIT command, the system automatically issues a GSETL command to position the table at the first record.
In the second MOVE statement, PERSONEL-KEY is the name of the five-character field where the literal string will be moved.
MOVE 'GETIT' TO PERSONEL-COMMAND MOVE 'EMPNO' TO PERSONEL-KEY MOVE 'ADEMP' TO PERSONEL-ELMLIST
The literal string is coded first, then the keyword TO followed by the field name. The literal string is the CA Datacom/DB key name EMPNO as defined in the CA Datacom/DB Directory. It must be enclosed within apostrophes. The key name EMPNO indicates that the table will be searched using the employee ID number as the key.
The second MOVE statement tells the Reporting Facility to move the literal string EMPNO to the field named PERSONEL-KEY.
In the third MOVE statement, PERSONEL-ELMLIST is the user-supplied name of the 11-character field where the literal string will be moved.
MOVE 'GETIT' TO PERSONEL-COMMAND MOVE 'EMPNO' TO PERSONEL-KEY MOVE 'ADEMP' TO PERSONEL-ELMLIST
The literal string is coded first, then the keyword TO followed by the field name. Although the literal string ADEMP is only 5 characters long, the field to which it is moved is 11 characters long.
When you are moving alphanumeric literals and the literal is too short, the receiving field is padded with blanks. If this is the case, the trailing blanks are used to satisfy the CA Datacom/DB requirement for the element list terminator. The data associated with the element ADEMP is accessed by CA Datacom/DB to produce the report.
The third MOVE statement tells the Reporting Facility to move the five-character literal string ADEMP to the field named PERSONEL-ELMLIST.
|
Copyright © 2014 CA.
All rights reserved.
|
|