0

It seems like I remember writing an RPG program that used embedded SQL that wrote a message to the interactive user job log whenever a SQL warning or error occurred. I did not have to explicitly write it; it logged it by default.

The program i am writing now is not doing this logging although I know I can cause warnings like 01003 and errors like 02000 and read them with the SQLState variable.

I don't think I imagined this behavior. Is there a H spec keyword that I forgot to set, the way I am calling the program (using CALL interactive), the way I wrote the SELECT INTO statement (static as opposed to dynamic)? I am at a loss for other ideas.

Mike
  • 1,274
  • 10
  • 24

3 Answers3

5

SqlStates 00000, 01###, and 02### do not produce logs though other states do. I would explicitly write anything to the log that you want to see there. You can easily write a sub-procedure that you can call after each sql statement to do the logging.

jmarkmurphy
  • 11,030
  • 31
  • 59
  • "Ding!" Thank you very much. – Mike Jan 30 '18 at 19:36
  • There is a project which contains a service program for messages. It was a part of the RPGUnit project. I have put it into a separate project so it can be easily reused. https://bitbucket.org/m1hael/message – Mihael Jan 31 '18 at 17:13
0

Sounds like the program is being run in a job with logging off..

DSPJOB --> 2. Display job definition attributes

Provides the most logging...

Message logging:                                               
  Level . . . . . . . . . . . . . . . . . . . . . :   4        
  Severity  . . . . . . . . . . . . . . . . . . . :   0        
  Text  . . . . . . . . . . . . . . . . . . . . . :   *SECLVL  
Log CL program commands . . . . . . . . . . . . . :   *YES  
Job log output  . . . . . . . . . . . . . . . . . :   *JOBEND

provides basically no logging...

Message logging:                                               
  Level . . . . . . . . . . . . . . . . . . . . . :   0        
  Severity  . . . . . . . . . . . . . . . . . . . :   99        
  Text  . . . . . . . . . . . . . . . . . . . . . :   *NOLIST
Log CL program commands . . . . . . . . . . . . . :   *NO  
Job log output  . . . . . . . . . . . . . . . . . :   *JOBEND
Charles
  • 21,637
  • 1
  • 20
  • 44
  • Thank you for the suggestion to check this, but right now it is at `Level = 4`, `Severity = 0`, `Text = *SECLVL`, `Log CL commands = *YES`, and `Job log output = *JOBEND`, exactly what you call the most logging configuration. – Mike Jan 30 '18 at 17:27
0

Run your job in debug mode (STRDBG UPDPROD(*YES)) to get additional diagnostics from all database operations.

David G
  • 3,940
  • 1
  • 22
  • 30