150 likes | 401 Views
Using Display files in CLLE and RPGLE. Creating commands. Passing Parameters in CLLE. Changes to the PGM statement: pgm parm(&parm1 &parm2 &parm3) PGM statement must exist if parameters are passed Parameters must be declared using DCL. Substring Function (%SST). p gm
E N D
Using Display files in CLLE and RPGLE Creating commands
Passing Parameters in CLLE Changes to the PGM statement: pgm parm(&parm1 &parm2 &parm3) PGM statement must exist if parameters are passed Parameters must be declared using DCL
Substring Function (%SST) pgm dcl &field1 *char 10 value(‘2010-02-24’) dcl &field2 *char 4 dcl &field3 *char 2 dcl &field4 *char 2 chgvar &field2 value(%sst(&field1 1 4) chgvar &field3 value(%sst(&field1 6 2) chgvar &field4 value(%sst(&field1 9 2) endpgm
FSPEC Review File name – name of file File Type – C for a Display file I, U, or O for Database Objects O, for Printer Files (reports) File Format – E for Externally Described Record Address Type – K if the object has a sort Device – Disk for Database Object Workstn for display files Printer for reports
RPG Verbs and Functions • Read filename; • reads a record from a database object • %EOF(filename) • Checks for End of File
Character Strings • Concatenating – use the + eg. field1 = ‘Jane ‘; field2 = ‘Doe ‘; field3 = field1 + field2; What will field3 have in it?
%Trim • Removes trailing and leading spaces from a character string eg. field1 = ‘ IBC233 ‘; field2 = %trim(field1); What will field2 have in it?
Programming tasks • Create a display file that uses all of the fields from the Student file. All of the fields should be output only. Feesowed and Finesowed should have the attribute Reverse Image (RI) conditioned by an indicator. Replace the name fields with a full name field. • Write an RPG program that displays each record in the Student file using the above display file. Feesowed and Finesowed should be displayed in Reverse Image if they are greater than zero.
Pseudo Code Initialize variables Receive information Do while not end of file Display the screen Receive information End of file: exit program