classAnova - Knowledge Shared


Posted by: Bob Cozzi
IT Researcher
Cozzi Productions, Inc.
North Aurora, IL
RPG Open - Documentation Group
has no ratings.
Published: 08 Feb 2011
Revised: 04 Aug 2011 - 3023 days ago
Last viewed on: 12 Nov 2019 (4926 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

RPG Open - Documentation Group Published by: Bob Cozzi on 08 Feb 2011 view comments

RPG Open

joblog - Write to the joblog

Syntax Diagram

joblog( string  [: s1 : s2 : ... ] );

The joblog procedure writes the string to the joblog after inserting the optional substitution values (S1, S2, etc.) into string. Here's how it's used in its basic form:

      /free
            joblog('Starting Monthly Processing');
      /end-free

The text 'Starting Monthy Processing' will be written tot he joblog. To include substitution values, you may either do it the traditional way, concatenating the values into one larger string and passing that string to the joblog() subprocedure, or include substitution values and specify those values as subsequent parameters.

      D custno          S              7P 0 
       /free
            joblog('Custom %s not found.': %char(custno));
      /end-free

The special symbol %s (lowercase 's') is used to identify where in the text string you want to insert the substitution values. Each substitution value is inserted into its corresponding %s location. This implies, and rightly so, that multiple substitution values may be specified.

      D Country         S             20A   Varying
      D custno          S              7P 0 
       /free
            joblog('Custom %s is located in %s'': %char(custno) : country);
      /end-free

Note that only text (character) values may be specified, so if numeric values are required, then use %CHAR (or %EDITC or %EDITW) to convert them to character.

The joblog subprocedures uses what's known as a Unix-style API and writes directly to the joblog itself. This API, however, requires that a linefeed is sent to the joblog before it actually writes out the message. This is due to the nature of how the POSIX/Unix APIs work. The RPG OPEN joblog subprocedure automatically inserts this linefeed character for your. (FYI, the linefeed character is X'25').

Return to RPGOpen.com

Return to classanova.com home page.
Sort Ascend | Descend

COMMENTS