OPS/MVS

  • 1.  Question on rexx

    Posted Aug 03, 2020 12:25 PM
    Hello,

    Is there an easy way to capture output from NSLookup command in automation point?  I would like it as a variable to pass in my rexx code.


  • 2.  RE: Question on rexx

    Broadcom Employee
    Posted Aug 04, 2020 03:39 AM

    Hi Randy, 
    For DOS commands in CA Automation Point yoiu can use the ADDRESS CMD function... It's to enter DOS commands...
    Here a sample of such rexx doing a NSLOOKUP and writing it to a file.. Later also reading the file and displaying it... 

    /* NSLOOKUP rexx */
    parse upper arg IPAddress

    /* If not argument is passed, use localhost        */
    if IPAddress = '' then IPAddress = 'localhost'
    Say "--- NSLOOKUP is used for a check on " IPAddress" ("time()")---"
    /* Trace I */

    /* Create a unique output file name using a random number generator */
    /* to prevent overwriting files previously created */
    /* Default limits are 0 and 999 Max of range cannot be more */
    /* than 100000 */
    TNUM = RANDOM(0, 999)

    /* Make unique file name and store in FNAME */
    FNAME = 'OUT'||TNUM||'.DAT'

    /* Run DOS command */
    ADDRESS CMD 'NSLOOKUP' IPAddress '> ' FNAME
    Say 'RC NSLOOKUP: ' rc

    /* Read a line at the time using the LINEIN command */
    /* Do while until end of output file NSlookup */
    DO WHILE LINES(FNAME)>0
         TESTIN = LINEIN(FNAME)
         SAY 'Output NSLOOKUP :' TESTIN
    END
    /* */
    Return

    The output shows :
    --- NSLOOKUP is used for a check on localhost (07:31:18)---
    RC NSLOOKUP: 0
    Output NSLOOKUP : Server: zzzzzz.dddddddd.xxxx
    Output NSLOOKUP : Address: nnn.nn.nnn.nn
    Output NSLOOKUP :
    Output NSLOOKUP : Name: localhost
    Output NSLOOKUP : Address: 127.0.0.1
    Output NSLOOKUP :

    Best regards,

    Hennie Hermans



    ------------------------------
    Principal Support Engineer
    CA Technologies, A Broadcom Company
    ------------------------------



  • 3.  RE: Question on rexx
    Best Answer

    Broadcom Employee
    Posted Aug 04, 2020 10:31 AM

    Hi Randy, 
    The ADDRESS CMD isnt a CA Automation Point command. That's why it's not in the CA AP manual.. It's a Open Object Rexx command...
    If you do the NSLOOKUP command at a Windows DOS Command box you get several lines... As i showed you at the sample i gave..
    The lines with 'Output NSLOOKUP:' are all the lines returned by the NSLOOKUP command..
    What you should do is filter out the line(s) you need in the DO loop and exit the DO loop when you have the proper line..
    Or save the results when you find the proper value you need in a variable and use it after the DO loop in your program..
    Best regards
    Hennie Hermans



    ------------------------------
    Principal Support Engineer
    CA Technologies, A Broadcom Company
    ------------------------------