free RPG - variable / constant definition

By kimot, 24 December, 2022
// Definition of a constant
DCL-C   max_size 100;
DCL-C   max_size CONST(100);
DCL-C   file_name 'example.txt';

// Variable definition 
DCL-S   file_name CHAR(10);      CHAR(bytes)  ... bytes count between 1 and 16,773,104
DCL-C   msg_len 5000;
DCL-S   message CHAR(msg_len);   (5000 bytes)

DCL-S   city VARCHAR(33);        VARCHAR(bytes).. bytes count between 1 and 16,773,104
DCL-S   cmdparm VARCHAR(10:4);   :2 or 4 byte prfx stores the length of the item

DCL-S   some_number INT(10);     INT(digits)  ...  digits can be 3, 5, 10, 20

DCL-S   variance FLOAT(8);       FLOAT(bytes)  ...  bytes can be 4, 8

DCL-S   count UNS(20);           3-digit unsigned        0 to 255
                                 5-digit unsigned        0 to 65535
                                10-digit unsigned        0 to 4294967295
                                20-digit unsigned        0 to 18446744073709551615

DCL-S   records PACKED(5);
DCL-S   budget PACKED(15:2);    4-byte float (8 digits)
                                8-byte float (16 digits)

Tags