Remove audit trail from a RLIST command issued via ADDRESS TSO - mainframe

I'm trying to write a script that would query specific resource profiles in a RACF class and later do a bit of logic to match a few things - not relevant.
The problem is that when I issue the command below I get the AUDIT TRAIL on the terminal. The script is meant to just return a 1 or a 0. All the logic works as it should but when I run the script I get the whole AUDIT TRAIL from RACF and at the bottom the result.
y = outtrap('resourceAccess.')
address tso 'RLIST CLASSX CLASSX.RESOURCE.LIST'
y = outtrap('off')
I already tried to create another outtrap after the one above with no success.
Is there a way to remove that AUDIT TRAIL bit?

It's possible that those lines of text are being issued in such a way that they cannot be trapped using outtrap and are instead being placed on the external data queue (EDQ) and then echoed to the terminal when the REXX exits. ACF2 does this with all output, making trapping command responses a bit tricky.
Try this:
/* Trap command response*/
y = outtrap('temp.')
address tso 'RLIST CLASSX CLASSX.RESOURCE.LIST'
y = outtrap('off')
/* Display anything put onto the EDQ */
do queued()
pull line
say line
end
Old answer:
If the output you are getting matches what's in the IBM docs you linked to (https://www.ibm.com/docs/en/szs/2.2?topic=effects-command-audit-trail), then what you need to do is after to have trapped the output, simply discard the first 2 lines, (which should be):
Command Audit Trail for USER IBMUSER
(one line of text and a blank line).
You could do this as follows:
y = outtrap('temp.')
address tso 'RLIST CLASSX CLASSX.RESOURCE.LIST'
y = outtrap('off')
/* Copy from the 3rd command response line into our 'real' response var */
do tempIndex = 3 to temp.0
desiredIndex = tempIndex - 2
resourceAccess.desiredIndex = temp.tempIndex
end
resourceAccess.0 = temp.0 - 2 /* Set number of lines */

Related

Using Rexx to find members in a PDS matching a given string

I am looking for help with my REXX script. Which should open an existing Member and search for a specific string.
Here is my script:
/* REXX */
"ALLOC FILE(input) DA('.....(MEMBER)') SHR REUSE"
"EXECIO * DISKR "input" (STEM input. FINIS"
"FREE FILE(input)"
/* Parmlib werden ausgelesen */
do i =1 to input.0
if POS('met,', input.i) > 0 Then
/* Code if string is found */
say Zeile gefunden
else
/* Code if string is not found */
say Zeile nicht gefunden
end
As cschneid stated this looks like something you would just use SuperC for. ISPF Option 3.14 or 3.15 will search for a string and show results. Also you can issue SRCHFOR from a member list and have only the found members then filtered in the member list. Additionally ISPF LM services can be used to go thru members of a PDS and then run an Edit macro to do the find. EXEXIO could be used to write the results to an output file. Note that SuperC will already do this using 3.15
Under ISPF, edit macros seem like a good fit. You can set up an ISPF stack if you're not running one already, works in batch too.
If I'm reading your requirement correctly, maybe something like this might work:
/* REXX-ISPF V/E macro */
Address ISREDIT
"MACRO (needle,dest)"
"CURSOR = 1 0"
lastHit = 0
i = 0
"SEEK "needle
Do While RC=0
"(l#) = CURSOR"
/* Conditional for multiple hits on same line */
If l# > lastHit Then Do /* do */
"(this) = LINE "l#
i=i+1; out.i = this
lastHit = l#
End
"SEEK "needle
End
out.0=i
Address TSO
"ALLOCATE F(OUT) DA("dest"') OLD"
"EXECIO "out.0" DISKW OUT (FINIS STEM out."
Exit 0
You can do this with much fewer lines with more ISPF services in a Macro (X ALL -> F ALL needle -> DEL ALL X -> CREATE dest). Or through intermittent use of ISPF E clipboard. That has some risks, so not going into that.
Good thing about ISPF E/V Macros is that thy use almost the same command you'd normally use in ISPF E/V. Find is quick. It needs to fit the whole dataset in the Region which might be an issue sometimes.
You could also call ISRSUPC from Rexx. There was a nifty Rexx exec published in MVS Update long ago. It searches for a string across all members of a PDS and presents the "hit list" on an ISPF panel, so you can edit or view the members.
I still use it (a descendant of it anyway) on my systems. I found the MVS Update article, here it is :
https://manualzz.com/doc/10913425/mvs0207

Is there a way to use the result of last run in the current run in Shiny?

I am using Shiny to build a dynamic dashboard for the user. I used if statement to divide my code into two main parts. There is an input called "New Line" that user needs to enter "Yes" or "No" as the value for this parameter. If user selects "Yes" the first part of the code will be ran and if he selects "No", it means that the first part is ran before and just the second part of the code needs to be ran. In the second part, there are some parameters from the first part. I want for Shiny to save the results and parameters calculate from ("New Line"==Yes) and use it for the next runs("New Line"==No) until the user change the answer for "New Line" to "Yes" again.
I used observeEvent function and an action button in Shiny. But the problem is that the results of ("New Line"==Yes) can not be used for the next runs.
shinyserver(function(input,output)){
observeEvent(input$click,{
if(input$'New Line' == 'Yes'){}
if(input$'New Line' == 'No'){}
})
}
I expect whenever user enters No for the New Line and hits the action button, the code can use the variables that are calculated when the New Line was Yes. But now whenever I set New Line as No and hit the action button , R just runs the second if. I can copy and paste all the lines from first if to tell R to run all of them again but those line takes about 30 minutes and I do not want to repeat them.
You need to serialise your values somewhere.
One example:
shinyserver(function(input,output)){
observeEvent(input$click,{
if(input$'New Line' == 'Yes'){
data <- result_of_some_function()
some_other_things()
write.csv(data, "file.csv") # saving the data somewhere on disk
}
if(input$'New Line' == 'No'){
mypreviousdata = read.csv("file.csv")
something <- somefunction(mypreviousdata)
}
})
}
Other than saving to CSV, you might prefer a database or the user's cookies, or whatever.

Lua: Parsing and Manipulating Input with Loops - Looking for Guidance

I am currently attempting to parse data that is sent from an outside source serially. An example is as such:
DATA|0|4|7x5|1|25|174-24|7x5|1|17|TERW|7x5|1|9|08MN|7x5|1|1|_
This data can come in many different lengths, but the first few pieces are all the same. Each "piece" originally comes in with CRLF after, so I've replaced them with string.gsub(input,"\r\n","|") so that is why my input looks the way it does.
The part I would like to parse is:
4|7x5|1|25|174-24|7x5|1|17|TERW|7x5|1|9|08MN|7x5|1|1|_
The "4" tells me that there will be four lines total to create this file. I'm using this as a means to set the amount of passes in the loop.
The 7x5 is the font height.
The 1 is the xpos.
The 25 is the ypos.
The variable data (172-24 in this case) is the text at these parameters.
As you can see, it should continue to loop this pattern throughout the input string received. Now the "4" can actually be any variable > 0; with each number equaling a set of four variables to capture.
Here is what I have so far. Please excuse the loop variable, start variable, and print commands. I'm using Linux to run this function to try to troubleshoot.
function loop_input(input)
var = tonumber(string.match(val, "DATA|0|(%d*).*"))
loop = string.match(val, "DATA|0|")
start = string.match(val, loop.."(%d*)|.*")
for obj = 1, var do
for i = 1, 4 do
if i == 1 then
i = "font" -- want the first group to be set to font
elseif i == 2 then
i = "xpos" -- want the second group to be set to xpos
elseif i == 3 then
i = "ypos" -- want the third group to be set to ypos
else
i = "txt" -- want the fourth group to be set to text
end
obj = font..xpos..ypos..txt
--print (i)
end
objects = objects..obj -- concatenate newly created obj variables with each pass
end
end
val = "DATA|0|4|7x5|1|25|174-24|7x5|1|17|TERW|7x5|1|9|08MN|7x5|1|1|_"
print(loop_input(val))
Ideally, I want to create a loop that, depending on the var variable, will plug in the captured variables between the pipe deliminators and then I can use them freely as I wish. When trying to troubleshoot with parenthesis around my four variables (like I have above), I receive the full list of four variables four times in a row. Now I'm having difficulty actually cycling through the input string and actually grabbing them out as the loop moves down the data string. I was thinking that using the pipes as a means to delineate variables from one another would help. Am I wrong? If it doesn't matter and I can keep the [/r/n]+ instead of each "|" then I am definitely all for that.
I've searched around and found some threads that I thought would help but I'm not sure if tables or splitting the inputs would be advisable. Like these threads:
Setting a variable in a for loop (with temporary variable) Lua
How do I make a dynamic variable name in Lua?
Most efficient way to parse a file in Lua
I'm fairly new to programming and trying to teach myself. So please excuse my beginner thread. I have both the "Lua Reference Manual" and "Programming in Lua" books in paperback which is how I've tried to mock my function(s) off of. But I'm having a problem making the connection.
I thank you all for any input or guidance you can offer!
Cheers.
Try this:
val = "DATA|0|4|7x5|1|25|174-24|7x5|1|17|TERW|7x5|1|9|08MN|7x5|1|1|_"
val = val .. "|"
data = val:match("DATA|0|%d+|(.*)$")
for fh,xpos,ypos,text in data:gmatch("(.-)|(.-)|(.-)|(.-)|") do
print(fh,xpos,ypos,text)
end

Dynamic Strings, AS2, needed on one line

Ok, so I'm creating a Flash HUD in AS2 that runs on the Surface and connects to our server.
As it stands now, I'm having to hard code the IP addresses for the Surface to connect to, and I'm trying to get past this.
I have 4 text fields for the user to enter the 4 fields of IP address data. My issue at the moment is that if I set the String variable literally, it works fine. But if I dynamically create the string, instead of outputting on one line, it outputs each of the 4 strings separately.
Here's my code:
var newIP1 = getIP.IPtext.IP1.text; //grabbing the data from the UI
var newIP2 = getIP.IPtext.IP2.text;
var newIP3 = getIP.IPtext.IP3.text;
var newIP4 = getIP.IPtext.IP4.text;
var ipArray = new Array(newIP1,newIP2,newIP3,newIP4); //setting the array
trace (ipArray.join(".")); // output the string, replacing the commas with a period
//output:
//10
//.255
//.255
//.22
//If I do this it works fine
var IPstr = "10.255.255.2";
trace(IPstr);
// output: 10.255.255.22
I appreciate any help on this, thanks in advance.
Your code looks good and should work as expected.
One thing to check would be to see if there isn't a carriage return or newline character being added to each individual input box. One way to check would be to check the length of each of your input strings to ensure there isn't an invisible character there.

Conditionally retaining variables in SAS

I have this SAS sample code:
data BEFORE;
input v1 v2;
datalines;
1 2
;
data AFTER;
put 'Before IF: ' _ALL_;
if _N_ = 1 then set BEFORE;
put 'After IF : ' _ALL_;
run;
The output is:
BEFORE: v1=. v2=. _ERROR_=0 _N_=1
AFTER : v1=1 v2=2 _ERROR_=0 _N_=1
BEFORE: v1=1 v2=2 _ERROR_=0 _N_=2
AFTER : v1=1 v2=2 _ERROR_=0 _N_=2
And the output file contains:
Obs v1 v2
1 1 2
2 1 2
I know that the SET will import and RETAIN the BEFORE dataset's variables, but why BEFORE's record gets duplicated?
I ran your sample code, and you omitted a crucial piece of information: This message was in the SAS log: "NOTE: DATA STEP stopped due to looping.". Googling on that message led me to a SAS paper describing the error. It suggested not using an IF statement before the SET statement, but to use the OBS= data set option to restrict the number of observations read.
So you would change the line:
if _N_ = 1 then set BEFORE;
to:
set BEFORE(obs=1);
When I ran your code with this change, the "Before IF:" line still printed twice, and I'm not sure why that is so. But the looping NOTE did not occur, so I believe that is the solution.
The SET is an executable statement, that is, unless being executed, it does not reset variables or load the next observation's data, when the data step is executed. (It sets up or alter PDV when the data step is compiled, though.) Because of the if condition, it is executed only once.
The implicit OUTPUT statement at the bottom outputs an observation per iteration. SAS, monitoring to see if a data step loops infinitely, stops the data step after the second iteration and generates the note.

Resources