× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



l
Hello Jan,

You wrote:
>I am trying to use the inline data file function within CL. I have been
>to Infocentre, to the archives (on midrange and on
>comp.sys.ibm.as400.misc), as well as some other resources. Where can I
>find an example of the use of this function?

This is part of a CL jobstream which is a historical complement to JCL and
OCL.  A piece of trivia:  OS/400 and most of the LPPs are (were?  I've
been away from that for a while) created using jobstream built and
submitted via RSCS (?) from VM.  It's probably all AIX based now.  Ahh,
how easily the rot sets in!

See below for a working example.  I use batch job streams to ship example
code.  It avoids me having to write an unpack utility (or the silly XML
version someone's done somewhere on the Web -- talk about reinventing the
wheel).

>I am trying it on a system that is at V4R4M0, SECLVL 40, and it is
>giving me 'Not allowed in this setting'. Checked the environments where
>allowed to run and there are no conflicts.

That simply means that the command (e.g., DATA) is not allowed, probably
because the source type is wrong.  It MUST be CL.

Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------

Here is a full example of using a CL job stream to build some components.
You could as easily include the data to be processed by the job stream
under the //DATA commands.  If you run this you'll get a neat CL utility
as well as learning something new.  Store the following lines in a source
file, change the &XXXXXXXX as described in the header, and use the
SBMDBJOB command to run it.

//BCHJOB   JOB(BLDCHKDIAG)
/*********************************************************************/
/*                                                                   */
/* Search and replace all occurrences of &XXXXXXXXXX with the name   */
/*   of the library in which you wish to create the objects.         */
/*                                                                   */
/*********************************************************************/
/*-------------------------------------------------------------------*/
/*                                                                   */
/*  Inline source files for the various programs and commands:       */
/*                                                                   */
/*  Type       Object           Inline file                          */
/*  ------     ----------       ----------                           */
/*  *CMD       CHKDIAGMSG       FILE1                                */
/*                                                                   */
/*  *PGM       CHKDIAGMSC       FILE2                                */
/*                                                                   */
/*  *PNLGRP    CHKDIAGMSH       FILE3                                */
/*                                                                   */
/*-------------------------------------------------------------------*/
/*********************************************************************/
/*-------------------------------------------------------------------*/
/* Create the objects                                                */
/*-------------------------------------------------------------------*/
CRTCMD     CMD(&XXXXXXXXXX/CHKDIAGMSG) PGM(CHKDIAGMSC) SRCFILE(FILE1) +
             ALLOW(*IPGM *BPGM *IREXX *BREXX) +
             HLPPNLGRP(CHKDIAGMSH) HLPID(CHKDIAGMSG) +
        l    TEXT('Check Diagnostic Message - CPP is CHKDIAGMSC.')

CRTCLPGM   PGM(&XXXXXXXXXX/CHKDIAGMSC) SRCFILE(FILE2) TEXT('Check +
             Diagnostic Message - CPP for CHKDIAGMSG.')

CRTPNLGRP  PNLGRP(&XXXXXXXXXX/CHKDIAGMSH) SRCFILE(FILE3) +
             TEXT('Check Diagnostic Message - help.')

/*-------------------------------------------------------------------*/
/* Source for the objects                                            */
/*-------------------------------------------------------------------*/

//DATA     FILE(FILE1) FILETYPE(*SRC)
/*‚** Start of specifications
**********************************************€*/
/*PARMS PGM(CHKDIAGMSC) HLPPNLGRP(CHKDIAGMSH) HLPID(CHKDIAGMSG)
€*/
/*PARMS ALLOW(*IPGM *BPGM *IREXX *BREXX *IMOD *BMOD)
€*/
/*‚
€*/
/*‚Command name  . . . . . . : CHKDIAGMSG
€*/
/*‚
€*/
/*‚Descriptive name  . . . . : Check Diagnostic Message.
€*/
/*‚
€*/
/*‚Function  . . . . . . . . : To check if an exception message was caused
€*/
/*‚                            by a specific diagnostic message.
€*/
/*‚
€*/
/*‚Copyright:
€*/
/*‚  (C) Copyright S.H. Coulter 1996, 1998. All rights reserved.
€*/
/*‚  (C) Copyright FlyByNight Software. 1996, 1998. All rights reserved.
€*/
/*‚
€*/
/*‚External references:
€*/
/*‚  Command processor . . . : CHKDIAGMSC
€*/
/*‚
€*/
/*‚  Messages  . . . . . . . :
€*/
/*‚
€*/
/*‚  Help panel group  . . . : CHKDIAGMSH
€*/
/*‚
€*/
/*‚  Programs  . . . . . . . :
€*/
/*‚
€*/
/*‚  Files . . . . . . . . . :
€*/
/*‚
€*/
/*‚  Data areas  . . . . . . :
€*/
/*‚
€*/
/*‚Notes:
€*/
/*‚  Dependencies  . . . . . :
€*/
/*‚
€*/
/*‚  Restrictions  . . . . . :
€*/
/*‚
€*/
/*‚  Support . . . . . . . . : shc@flybynight.com.au
€*/
/*‚
€*/
/*‚Change activity:
€*/
/*‚              Rlse &
€*/
/*‚Flag Reason   Level  Date   Pgmr       Comments
€*/
/*‚---- -------- ------ ------ ----------
----------------------------------€*/
/*‚$A0= D               960924 SHC:       Initial coding of module.
€*/
/*‚
€*/
/*‚Change activity detail:
€*/
/*‚ A0 -                                   l
€*/
/*‚
€*/
/*‚** End of specifications
************************************************€*/

 CHKDIAGMSG: CMD        PROMPT('Check Diagnostic Message')

             PARM       KWD(MSGID) TYPE(*NAME) LEN(7) MIN(1) +
                          EXPR(*YES) PROMPT('Message identifier')

             PARM       KWD(FOUND) TYPE(*LGL) LEN(1) RTNVAL(*YES) +
                          MIN(1) PROMPT('CL var for FOUND         +
                          (1)')

             PARM       KWD(RMV) TYPE(*CHAR) LEN(1) RSTD(*YES) +
                          DFT(*YES) SPCVAL((*YES 'Y') (*NO 'N')) +
                          PROMPT('Remove messages if found')
//

//DATA     FILE(FILE2) FILETYPE(*SRC)
/*‚** Start of specifications
**********************************************€*/
/*PARMS
€*/
/*‚
€*/
/*‚Module name . . . . . . . : CHKDIAGMSC
€*/
/*‚
€*/
/*‚Descriptive name  . . . . : Check Diagnostic Message
€*/
/*‚
€*/
/*‚Function  . . . . . . . . : Command processing program for CHKDIAGMSG
€*/
/*‚
€*/
/*‚Copyright:
€*/
/*‚  (C) Copyright S.H. Coulter 1996, 1998. All rights reserved.
€*/
/*‚  (C) Copyright FlyByNight Software. 1996, 1998. All rights reserved.
€*/
/*‚
€*/
/*‚Module type:
€*/
/*‚  Processor . . . . . . . : CLP
€*/
/*‚
€*/
/*‚  Module size . . . . . . :
€*/
/*‚
€*/
/*‚  Attributes  . . . . . . :
€*/
/*‚
€*/
/*‚Entry:
€*/
/*‚  Entry point . . . . . . : CHKDIAGMSC
€*/
/*‚
€*/
/*‚  Purpose . . . . . . . . : (See function)
€*/
/*‚
€*/
/*‚  Linkage . . . . . . . . : CPP for CHKDIAGMSG
€*/
/*‚
€*/
/*‚Input . . . . . . . . . . : &MSGID_I    - Message identifier
€*/
/*‚                            &RMV        - Remove messages
€*/
/*‚
€*/
/*‚Output  . . . . . . . . . : &RESULT     - Result
€*/
/*‚
€*/
/*‚External references:
€*/
/*‚  Routines  . . . . . . . : STDERR     - Standard error handler
€*/
/*‚
€*/
/*‚  Files . . . . . . . . . :
€*/
/*‚
€*/
/*‚  Data areas  . . . . . . :
€*/
/*‚
€*/
/*‚  Control blocks  . . . . :            l
€*/
/*‚
€*/
/*‚  References from UIM . . :
€*/
/*‚
€*/
/*‚Exits-- Normal  . . . . . : Return to NSI
€*/
/*‚     -- Error . . . . . . : Resignal escape message to caller
€*/
/*‚
€*/
/*‚Messages:
€*/
/*‚  Generated . . . . . . . : CPF9898 - Impromptu messages
€*/
/*‚
€*/
/*‚  Resignalled . . . . . . : *ESCAPE messages
€*/
/*‚                            *NOTIFY messages
€*/
/*‚
€*/
/*‚  Monitored . . . . . . . : CPF9999 - Function check exceptions
€*/
/*‚
€*/
/*‚Macros/Includes . . . . . :
€*/
/*‚
€*/
/*‚Data/Tables . . . . . . . :
€*/
/*‚
€*/
/*‚Notes:
€*/
/*‚  Dependencies  . . . . . : STDERR     - Standard error handler
€*/
/*‚
€*/
/*‚  Restrictions  . . . . . :
€*/
/*‚
€*/
/*‚  Register conventions  . : N/A
€*/
/*‚
€*/
/*‚  Patch label . . . . . . : N/A
€*/
/*‚
€*/
/*‚  Support . . . . . . . . : shc@flybynight.com.au
€*/
/*‚
€*/
/*‚Change activity:
€*/
/*‚              Rlse &
€*/
/*‚Flag Reason   Level  Date   Pgmr       Comments
€*/
/*‚---- -------- ------ ------ ----------
----------------------------------€*/
/*‚$A0= D               960924 SHC:       Initial coding of module.
€*/
/*‚
€*/
/*‚Change activity detail:
€*/
/*‚ A0 -
€*/
/*‚
€*/
/*‚** End of specifications
************************************************€*/

 CHKDIAGMSC: PGM        PARM(&MSGID_I &RESULT &RMV)

/*‚                                                               €*/
/*‚---------------- Input Parameter Declarations -----------------€*/
/*‚                                                               €*/
             DCL        VAR(&MSGID_I) TYPE(*CHAR) LEN(7)
                        /*‚Message identifier                     €*/
             DCL        VAR(&RESULT) TYPE(*LGL) LEN(1)
                        /*‚Result : '0' = not found; '1' = found  €*/
             DCL        VAR(&RMV) TYPE(*CHAR) LEN(1)
                        /*‚Error flag                             €*/

/*‚                                                               €*/
/*‚------------------- Program Declarations ----------------------€*/
/*‚                    l                                          €*/
             DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)
                        /*‚Message identifier                     €*/
             DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
                        /*‚Message substitution data              €*/
             DCL        VAR(&EXCPKEY) TYPE(*CHAR) LEN(4)
                        /*‚Message marker *ESCAPE                 €*/
             DCL        VAR(&DIAGKEY) TYPE(*CHAR) LEN(4)
                        /*‚Message marker *DIAG                   €*/
             DCL        VAR(&ERROR) TYPE(*LGL) LEN(1)
                        /*‚Error flag                             €*/

/*‚                                                               €*/
/*‚---------------- Mnemonic Value Declarations ------------------€*/
/*‚                                                               €*/
             DCL        VAR(&BLANK) TYPE(*CHAR) LEN(1) VALUE(X'40')
                        /*‚Mnemonic for 'blank'                   €*/
             DCL        VAR(&TRUE) TYPE(*LGL) LEN(1) VALUE('1')
                        /*‚Mnemonic for 'true'                    €*/
             DCL        VAR(&FALSE) TYPE(*LGL) LEN(1) VALUE('0')
                        /*‚Mnemonic for 'false'                   €*/
             DCL        VAR(&STAR) TYPE(*CHAR) LEN(1) VALUE('*')
                        /*‚Mnemonic for 'asterisk'                €*/
             DCL        VAR(&QUOTE) TYPE(*CHAR) LEN(1) VALUE('''')
                        /*‚Mnemonic for 'quote'                   €*/
             DCL        VAR(&BATCH) TYPE(*CHAR) LEN(1) VALUE('0')
                        /*‚Mnemonic for 'batch job'               €*/
             DCL        VAR(&INTER) TYPE(*CHAR) LEN(1) VALUE('1')
                        /*‚Mnemonic for 'interactive job'         €*/
             DCL        VAR(&ZERO) TYPE(*DEC) LEN(1 0) VALUE(0)
                        /*‚Mnemonic for 'zero'                    €*/
             DCL        VAR(&HEX00) TYPE(*CHAR) LEN(2) VALUE(X'0000')
                        /*‚Mnemonic for 'binary zero'             €*/
             DCL        VAR(&YES) TYPE(*CHAR) LEN(1) VALUE('Y')
                        /*‚Mnemonic for 'yes'                     €*/
             DCL        VAR(&NO) TYPE(*CHAR) LEN(1) VALUE('N')
                        /*‚Mnemonic for 'no'                      €*/

/*‚                                                               €*/
/*‚------------------- Copyright Declarations --------------------€*/
/*‚                                                               €*/
             DCL        VAR(&COPYRIGHT) TYPE(*CHAR) LEN(80) +
                          VALUE('Copyright (C) FlyByNight Software. +
                          1996, 1998.')

/*‚                                                               €*/
/*‚-------------- Global Message Monitor Intercept ---------------€*/
/*‚                                                               €*/
             MONMSG     MSGID(CPF9999) EXEC(GOTO CMDLBL(FAILED))

/*‚                                                               €*/
/*‚---------- Force Copyright Notice in Executable Code ----------€*/
/*‚                                                               €*/
             CHGVAR     VAR(&COPYRIGHT) VALUE(&COPYRIGHT)

/*‚                                                               €*/
/*‚----------------- Send the Copyright Notice -------------------€*/
/*‚                                                               €*/
             SNDPGMMSG  MSG(&COPYRIGHT) TOPGMQ(*SAME)

             /*‚Initialise error indicator.                       €*/
             CHGVAR     VAR(&ERROR) VALUE(&FALSE)

             /*‚Assume the diagnostic message won't be found.     €*/
             CHGVAR     VAR(&RESULT) VALUE(&FALSE)

             /*‚Get the exception message for our caller ...      €*/
             /*‚  -- leave the exception as unhandled.            €*/
             RCVMSG     PGMQ(*PRV) MSGTYPE(*EXCP) RMV(*KEEPEXCP) +
  l                       KEYVAR(&EXCPKEY)
             /*‚Get the previous diagnostic message ...           €*/
             RCVMSG     PGMQ(*PRV) MSGTYPE(*PRV) MSGKEY(&EXCPKEY) +
                          RMV(*NO) KEYVAR(&DIAGKEY) MSGID(&MSGID)
             /*‚If the message identifier matches the one the     €*/
             /*‚  caller supplied ...                             €*/
             IF         COND(&MSGID *EQ &MSGID_I) THEN(DO)
               /*‚... indicate the message was found.             €*/
               CHGVAR     VAR(&RESULT) VALUE(&TRUE)
               /*‚If the messages are to be removed ...           €*/
               IF         COND(&RMV *EQ &YES) THEN(DO)
                 RMVMSG     PGMQ(*PRV) MSGKEY(&DIAGKEY) /* Not found   */
                 RMVMSG     PGMQ(*PRV) MSGKEY(&EXCPKEY) /* Not deleted */
               ENDDO
             ENDDO

 EXIT:       RETURN     /*‚Normal end of program                  €*/

/*‚                                                               €*/
/*‚--------------------- Exception Routine -----------------------€*/
/*‚                                                               €*/
 FAILED:     STDERR     PGMTYPE(*CPP)
             MONMSG     MSGID(CPF9999) /*‚Just in case            €*/

 CHKDIAGMSX: ENDPGM
//

//DATA     FILE(FILE3) FILETYPE(*SRC)
.*‚*** Start of specifications
************************************************
.*PARMS
*
.*‚
*
.*‚Title  . . . . . . . . . : CHKDIAGMSH
*
.*‚
*
.*‚Function . . . . . . . . : Check Diagnostic Message - help
*
.*‚
*
.*‚Copyright:
*
.*‚  (C) Copyright S.H. Coulter 1996, 1998. All rights reserved.
*
.*‚  (C) Copyright FlyByNight Software. 1996, 1998. All rights reserved.
*
.*‚
*
.*‚Notes:
*
.*‚  Dependencies  . . . . . :
*
.*‚
*
.*‚  Restrictions  . . . . . :
*
.*‚
*
.*‚External references:
*
.*‚  Help modules  . . . . . :
*
.*‚
*
.*‚  Includes  . . . . . . . :
*
.*‚
*
.*‚Panels contained  . . . . :
*
.*‚
*
.*‚Allowed tags:
*
.*‚  :pnlgrp.   First tag in source                       :epnlgrp.
*
.*‚ Prologue
*
.*‚  :help.     Start of help area                        :ehelp.
*
.*‚  :ischsyn.  Index search synonym
*
.*‚  :isch.     Index search
*
.*‚  :imhelp.   Imbed help
*
.*‚  :p.        Paragraph
*
.*‚  :pc.       Paragraph continuation
*
.*‚  :cit.      Start of citation text                    :ecit.
l
.*‚  :nt.       Start of notation text                    :ent.
*
.*‚  :parml.    Parameter list                            :eparml.
*
.*‚  :pt.       Parameter term
*
.*‚  :pd        Parameter description
*
.*‚  :pk [DEF]. Programming keyword - DEF means default   :epk.
*
.*‚  :pv.       Programming variable                      :epv.
*
.*‚  :ol.       Ordered list                              :eol.
*
.*‚  :sl.       Simple list                               :esl.
*
.*‚  :ul.       Unordered list                            :eul.
*
.*‚  :li.       List item
*
.*‚  :lp.       List part
*
.*‚  :dl.       Definition list                           :edl.
*
.*‚  :dt.       Definition term
*
.*‚  :dd.       Definition description
*
.*‚  :link.     Hypertext link definition                 :elink
*
.*‚  :h1.       Heading                                   :eh1.
*
.*‚  :h2.       Heading                                   :eh2.
*
.*‚  :h3.       Heading                                   :eh3.
*
.*‚  :h4.       Heading                                   :eh4.
*
.*‚  :xh1.      Extended heading                          :exh1.
*
.*‚  :xh2.      Extended heading                          :exh2.
*
.*‚  :xh3.      Extended heading                          :exh3.
*
.*‚  :xh4.      Extended heading                          :exh4.
*
.*‚  :hp0.      Highlighted phrase                        :ehp0.
*
.*‚    :             :         :                            :
*
.*‚  :hp9.      Highlighted phrase                        :ehp9.
*
.*‚  :xmp.      Example                                   :exmp.
*
.*‚  :fig.      Example                                   :efig.
*
.*‚  :lines.    Unformatted lines                         :elines.
*
.*‚
*
.*‚Symbols:
*
.*‚  &amp.      Ampersand   '&'
*
.*‚  &colon.    Colon       ':'
*
.*‚  &cont.     Forces concatenation
*
.*‚  &msg       Message text              &msg(msgid, msgf, msgflib)
*
.*‚  &period.   Period      '.'
*
.*‚  &slr.      Right slash '/'
*
.*‚
*
.*‚Notes:
*
.*‚  Support . . . . . . . . : shc@flybynight.com.au
*
.*‚
*
.*‚Change activity:
*
.*‚              Rlse &
*
.*‚Flag Reason   Level  Date   Pgmr       Comments
*
.*‚---- -------- ------ ------ ----------
----------------------------------- *
.*‚$A0=                 960924 SHC:       Initial coding of panel group.
*
.*‚
*
.*‚Change activity detail:
*
.*‚ A0 -
*
.*‚                       l
*
.*‚*** End of specifications
**************************************************
.*‚
:pnlgrp.
:help name='CHKDIAGMSG'       .Check Diagnostic Message - Help
:p.
The Check Diagnostic Message (CHKDIAGMSG) command checks if a
specified message identifier was received before an exception message
and optionally removes both the exception message and the diagnostic
message from the program message queue.
:p.
This command is useful when an IBM command sends a generic exception
message advising you to check previous diagnostic messages for the
real problem.  For example&colon.
:lines.
             DSPMSGD    RANGE(&MSGID) MSGF(&ODLBNM/&ODOBNM)
             /* Message not found ... search next message file     */
             MONMSG     MSGID(CPF2519) EXEC(DO)
               CHKDIAGMSG MSGID(CPF2419) FOUND(&FOUND)
:elines.
:p.
:hp3.Restrictions&colon.:ehp3.  This command is valid only in
compiled CL programs.
:ehelp.
.*‚*********************************************************
.*‚
.*‚Parameter 1 - help text
.*‚
:help name='CHKDIAGMSG/msgid'      .Message identifier (MSGID) - Help
:xh3.Message identifier (MSGID)
:p.
Specifies the message identifier of a diagnostic message which is
being checked for existence in the program message queue.
:p.
This is a required parameter.
:p.
The possible values are&colon.
:parml.
:pt.
:pv.
message-identifier
:epv.
:pd.
The message identifier must be 7 characters in length and in the
following format&colon.
:lines.
    pppnnnn
:elines.
The first 3 characters must be a code consisting of an alphabetic
character followed by two alphanumeric (alphabetic or decimal)
characters; the last 4 characters can consist of numbers ranging
from 0 through 9 and characters ranging from A through F.
:eparml.
:ehelp.
.*‚*********************************************************
.*‚
.*‚Parameter 2 - help text
.*‚
:help name='CHKDIAGMSG/found' .CL var for FOUND         (1) (FOUND) - Help
:xh3.CL var for FOUND         (1) (FOUND)
:p.
Specifies the name of
the CL variable that receives the 1-character value indicating whether
the message was found.  A logical value of 0 indicates that the
specified message identifier was not found, a logical value of 1
indicates the message identifier was found.
The variable must be a logical variable with a minimum length of 1
character.
:ehelp.
.*‚*********************************************************
.*‚
.*‚Parameter 3 - help text
.*‚
:help name='CHKDIAGMSG/rmv'      .Remove messages if found (RMV) - Help
:xh3.Remove messages if found (RMV)
:p.
Specifies whether the exception and diagnostic messages are removed if
the specified diagnostic message is found in the program message queue.
:p.
The possible values are&colon.
:parml.
:pt.
:pk def.
*YES
:epk.
:pd.
The messages are removed from the program message queue.  If the
exception message is an unhandled exception, the exception is handled
by running the CHKDIAGMSG command.
:pt.
:pk.
*NO
:epk.
:pd.
The messages are not removed from the program message queue.  They are
left on the program message queue as old messages.
:nt.
Old messages are messages that have been received but not
deleted.  An old message can be received again in one of the
following ways&colon.
:ent.
:ol.
:li.
The message reference key of the message is specified for the Message
key (MSGKEY) parameter of the RCVMSG command.
:li.
A message type of *FIRST, *LAST, *NEXT, or *PRV is specified for the
Message type (MSGTYPE) parameter of the RCVMSG command.
:eol.
:p.
If the exception message is an unhandled exception,
the exception is left unhandled and the message is
left on the message queue as a new message.  It can be received
again by using the RCVMSG command to receive an *EXCP message.
:p.
To handle an exception after the CHKDIAGMSG has been run, the
RCVMSG command can be run specifying RMV(*YES) or RMV(*NO).
:eparml.
:ehelp.
.*‚Repeat as needed.
:epnlgrp.
//
/*****************************l*************************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
//ENDBCHJOB



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.