POST (Post)

Free-Form Syntax POST{(E)} {program-device} file-name
Code Factor 1 Factor 2 Result Field Indicators
POST (E) program-device file-name INFDS name _ ER _
The POST operation puts information in an INFDS (file information data structure). This information contains the following:
  • File Feedback Information specific to RPG I/O for the file
  • Open Feedback Information for the file
  • Input/Output Feedback Information and Device Dependent Feedback Information for the file OR Get Attribute Information

The program-device operand specifies a program device name to get information about that specific program device. If you specify a program device, the file must be defined as a WORKSTN file. If program-device is specified, then the INFDS will contain Get Attribute Information following the Open Feedback Information. Use either a character field of length 10 or less, a character literal, or a character named constant. If program-device is not specified, then the INFDS will contain Input/Output Feedback Information and Device Dependent Feedback Information following the Open Feedback Information.

Specify the name of a file in the file-name operand. Information for this file is posted in the INFDS associated with this file.

In free-form syntax, you must specify a file-name and cannot specify an INFDS name. In traditional syntax, you can specify a file-name, an INFDS name, or both.
  • If you do not specify an INFDS name, the INFDS associated with this file using the INFDS keyword in the file specification will be used.
  • If you do not specify an INFDS name in traditional syntax, you must specify the data structure name that has been used in the INFDS keyword for the file specification in the result field; information from the associated file in the file specification will be posted.

To handle POST exceptions (file status codes greater than 1000), either the operation code extender 'E' or an error indicator ER can be specified, but not both. For more information on error handling, see File Exception/Errors.

Even when a POST operation code is not processed, its existence in your program can affect the way the RPG IV language operates. The presence of a POST operation with no program-device specified can affect the posting of feedback to one or more files.
  • The presence of a POST operation with no program-device specified for a file defined on a global File specification will affect the implicit posting of feedback to the INFDS for all global files in the module.
  • The presence of a POST operation with no program-device specified for a global file will have no effect on the implicit posting of feedback to the INFDS for files defined in subprocedures.
  • The presence of a POST operation with no program-device specified for a locally-defined file will only affect the implicit posting of feedback to the INFDS for that file; it will have no effect for global files, or for other files defined in that subprocedure.
  • The implicit posting of feedback to the INFDS for a file that is passed as a parameter is determined by the module in which the file is defined. A POST operation with no program-device specified to a file parameter may be redundant if the feedback information is always posted to that file's INFDS.
  • If a global file is passed as a parameter to another procedure in the same module, and that procedure does a POST operation to its parameter, that POST operation will not be considered to be a POST operation to a global file.

Usually, the INFDS is updated at each input and output operation or block of operations. However, if the presence of a POST operation affects the posting of feedback to the INFDS of a file, then RPG IV updates the I/O Feedback Information area and the Device Dependent Feedback Information area in the INFDS of the file only when you process a POST operation for the file. The File Dependent Information in the INFDS is updated on all Input/Output operations. If you have opened a file for multiple-member processing, the Open Feedback Information in the INFDS will be updated when an input operation (READ, READP, READE READPE) causes a new member to be opened.

Note that DUMP retrieves its information directly from the Open Data Path and not from the INFDS, so the file information sections of the DUMP do not depend on POST.

If a program has no POST operation code, or if it has only POST operation codes with program-device specified, the Input/Output Feedback and Device Dependent Feedback section is updated with each input/output operation or block of operations. If RPG is blocking records, most of the information in the INFDS will be valid only for the last complete block of records processed. When doing blocked input, from a data base file, RPG will update the relative record number and key information in the INFDS for each read, not just the last block of records processed. If you require more accurate information, do not use record blocking. See File Information Data Structure for more information on record blocking. If you do not require feedback information after every input/output operation, you may be able to improve performance by using the POST operation only when you require the feedback information.

When a POST operation is processed, the associated file must be open. If you specify a program device on the POST operation, it does not have to be acquired by the file.

For more information, see File Operations.