IBM Security Z Security

 View Only
  • 1.  DEFINE a constant (fixed value) in CARLa

    Posted Thu November 18, 2021 01:10 PM

    Hi,

    Does any one know if it is possible to create a constant (fixed value) in CARLa using the DEFINE command, where I can explicitly specify the value of the constant, not getting it from any other field/variable?

    Basically, I am working with two "reports":

    The first one is a fixed list, containing two columns: system variable(symbol) and the value of the variable.

    Example:

    TEST1   0001
    TEST2   0002
    TEST3   0003

    The second report is a verification of a system configuration:

    newlist type=system name=SYSTEM3 fieldsep=';'
    select smftwt<>"00:30"
    sortlist system smftwt

    However, in the second report's sortlist I need to include the information of a specific symbol from the fixed list.

    To do that, I would need to create a constant where I could explicitly define its value, for example: 'symtest' would contain the value TEST2

    In this case, I would be able to get the information from the other list like this:

    deftype type=#sym
    alloc type=#sym,
    path='xxxxxx/xxxxxx/xxxxxxx'
    def type=#sym #symbol as word(record,1)
    def type=#sym #empnum as word(record,2)
    newlist type=system name=SYSTEM3 fieldsep=';',
    select smftwt<>"00:30"
    sortlist system smftwt symtest symtest:#sym.#symbol.#empnum

    It would basically search for the symtest value from the fixed list and include 'TEST2 0002' in the results. However, if I can't define a constant with a fixed value and give it the value I want, I won't be able to do it. I tried to do it in many ways using DEFINE, but I failed. Maybe it's very simple to do it, but I confess I wasn't able to.

    Thanks.



    ------------------------------
    Danilo Farias
    ------------------------------


  • 2.  RE: DEFINE a constant (fixed value) in CARLa

    IBM Champion
    Posted Fri November 19, 2021 04:20 AM
    Edited by Rob van Hoboken Fri November 19, 2021 04:32 AM

    Use the STR$BLANK format to include a fixed value through a defined field.  This is designed to print a STRING VALUE when a BOOLEAN is TRUE, and BLANK when it is FALSE.  So:

    define symtest(str$blank('TEST2'),5) true

    With the overriding length 5 you could get 5 blanks to be printed when a variable condition is off, for example, only print TEST2 when you're analyzing system ABCD:

    define sysABCD(str$blank('TEST2'),5) boolean where system=ABCD

    For other reports you should check the CHR$STR format, this can print a fixed STRING VALUE when a character field is empty, and otherwise print the field value.

    If you wish to define SYMTEST before the actual NEWLIST TYPE=SYSTEM command, you can add the newlist type in the DEFINE command, like so

    define type=system symtest(str$blank('TEST2'),5) true

    Neither of these formatted output fields can be used as the base for a LOOKUP, since the field value is merely TRUE, and not really TEST2.  If you want a REAL character field, containing TEST2, you should read this value from a DEFTYPE (external) file, and print it with a lookup from a field with a predictable value.

    ------------------------------
    Rob van Hoboken
    ------------------------------



  • 3.  RE: DEFINE a constant (fixed value) in CARLa

    Posted Fri November 19, 2021 05:08 AM
    Edited by Jeroen Tiggelman Fri November 19, 2021 05:11 AM
    Hi Danilo,

    I don't think the thing what you are asking for is possible in that way. Normally when you annotate information, you base that on a value from the record that you want to annotate. (For example, usually when you want to print an employee number, you would base that on, say, a user id in the record.)

    So, what you basically seem to want to do here is to specify a bunch of literal values sprinkled throughout the report through specifying one key, without a real association from the record to that key.

    A way you can do that is come from the "annotation file" as the report type to pick up all those literal values, and from there generate the query of the report type you really want to have executed and annotated with those values, resulting in a two pass query, like so:

    deftype type=#sym
    alloc type=#sym,
    path='xxxxxx/xxxxxx/xxxxxxx'
    def type=#sym #symbol as word(record,1)
    def type=#sym #empnum as word(record,2)
    option dd=ckr2pass
    newlist type=#sym outlim=1 nopage
    select #symbol=TEST2
    sortlist `newlist type=system name=SYSTEM3 fieldsep=';',` /,
    `select smftwt<>"00:30"` /,
    `sortlist system smftwt '` | #symbol(0) #empnum(0) | `'`

    If you run this in the user interface like this, you should see the result of substituting the literals into the query, then you can press PF3 and run this query for the real result. This is because of the OPTION DD=CKR2PASS, which activates the two-pass query infrastructure. (If you want to run this in the batch, you need to use a different setup for this.)

    The main query has NOPAGE because you are generating another query so you don't want page or column headers at that level. The OUTLIM=1 is just there to protect against TEST2 occurring on multiple lines [but that hopefully is not the case]; the duplicate entries would get ignored that way.

    I use backquotes for what are literals from the perspective of the first query. The things that are backquoted essentially form the new query. That is basically everything except for the newlines and the literals that you are substituting. As to those literals, you can see that I generate single quotes around them so that they are literals to the generated query. I used overriding length 0 as I was guessing that the default output length of RECORD was not what you wanted to use there, but you might have a different column length in mind.

    I hope this begins to help with what you are really trying to achieve.

    Let me know if you have additional questions.

    Best regards,​

    ------------------------------
    Jeroen Tiggelman
    Software Development and Level 3 Support Manager IBM Security zSecure Suite
    IBM
    Delft
    ------------------------------



  • 4.  RE: DEFINE a constant (fixed value) in CARLa

    Posted Fri November 19, 2021 07:39 AM

    Hi Jeroen,

    That is not exactly the idea I thought for this to work, but what you just explained worked perfectly. You got it! I really appreciate it.

    And yes, I do need to find a way of running this in batch: run the first query to substitute the information I need and build the second query, then run the second query to finally get the results I need. You said the setup would be different for a batch process, but is it possible to use the CKR2PASS in a similar way while running it in batch? Perhaps printing the built query in another file, then just executing it in the same code?

    I will try to do some research on it, but any hints would be very appreciated.


    Thank you so much for the help so far.



    ------------------------------
    Danilo Farias
    ------------------------------



  • 5.  RE: DEFINE a constant (fixed value) in CARLa

    Posted Fri November 19, 2021 07:57 AM
    Hi Danilo,

    Glad to hear that this helps you.

    Yes, in batch you essentially write out the query you generate to a file and then use that as input in a next step.

    The product ships with a sample procedure C2RC2 in SCKRPROC (and a sample job C2RJ2 in SCKRSAMP) that could be used as inspiration. :-)

    JJW

    ------------------------------
    Jeroen Tiggelman
    Software Development and Level 3 Support Manager IBM Security zSecure Suite
    IBM
    Delft
    ------------------------------