I know that there's the DIPSLAY operand that let's you "log" any variable value. However, my question is: is there someway to do something like the var_dump of PHP of console.log of javascript which when you give them a variable, they print with values and also name of variable.
Let's say for example I have the following data:
01 MY-DATA.
05 FIRST-PART PIC X(05) VALUE 'DATA1'.
05 SECOND-PART PIC X(05) VALUE 'DATA2'.
My question is: is there someway to have something like this on my log (with a single call and for any given variable):
'MY-DATA:'
'FIRSTPART : DATA1'
'SECOND PART: DATA2'
Thanks
Not with any currently supported mainframe IBM COBOL compiler (I see you have tagged your question with "mainframe").
There used to be the EXHIBIT statement, which is not implemented in Enterprise COBOL. There is some discussion at that link about implementing similar functionality yourself.
I wrote an ISPF edit macro for myself to generate COBOL code to do the equivalent DISPLAY as indicated at the IBM documentation link above.
Overkill would be to call CEE3DMP, but I've been known to engage in overkill when frustrated.
You might be able to use one of the other, more granular Language Environment dump services such as CEEVDMP or CEEHDMP.