Store the output of tso whois command using REXX



IBM's Command List programming language & Restructured Extended Executor

Store the output of tso whois command using REXX

Postby Dheeraj Sharma » Mon Sep 30, 2013 2:16 pm

How to store the output of tso whois command using REXX in output file?
Dheeraj Sharma
 
Posts: 12
Joined: Mon Sep 30, 2013 1:55 pm
Has thanked: 8 times
Been thanked: 0 time

Re: Store the output of tso whois command using REXX

 

Re: REXX

Postby Stefan » Mon Sep 30, 2013 2:29 pm

If the WHOIS command does not use the TPUT macro to write its output to the terminal, it is possible to trap the output by using the OUTTRAP() function.
Sample:
x = outtrap(.trap)
address tso "whois myuserid"
x = outtrap('OFF')
do i = 1 by 1 to trap.0
   say trap.i
end
There are 10 types of people in the world: Those who understand binary, and those who don't.

These users thanked the author Stefan for the post:
Dheeraj Sharma (Thu Oct 03, 2013 9:00 am)
User avatar
Stefan
 
Posts: 27
Joined: Tue Aug 21, 2012 3:02 pm
Has thanked: 0 time
Been thanked: 2 times

Re: Store the output of tso whois command using REXX

Postby Akatsukami » Mon Sep 30, 2013 9:04 pm

Remember that WHOIS is not a TSO command, but a popular name for locally-written CLISTs and execs that give information about a user. Inspection of the code may be necessary.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
Dheeraj Sharma (Thu Oct 03, 2013 9:00 am)
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Store the output of tso whois command using REXX

Postby Pedro » Mon Sep 30, 2013 9:23 pm

re:
x = outtrap(.trap)

I think it should be:
x = outtrap('trap.')

Because the period should be at the end.


How to store the output of tso whois command using REXX in output file?

Use the same stem in the EXECIO as is used in the OUTTRAP
x = outtrap('trap.')
address tso "whois myuserid"
x = outtrap('OFF')
Address TSO "ALLOC FILE(TRAPDD) BLKSIZE(0) LRECL(133) NEW REU",       
            " SPACE(5,5) CYL RECFM(F,B) "                               
Address TSO 'EXECIO ' trap.0 ' DISKW TRAPDD ( FINIS  STEM TRAP.'
Pedro Vera

These users thanked the author Pedro for the post:
Dheeraj Sharma (Thu Oct 03, 2013 9:00 am)
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: Store the output of tso whois command using REXX

Postby Dheeraj Sharma » Thu Oct 03, 2013 9:22 am

Hi All,
Thanks you for your valuable responses, however still i am not able to store it in output file. I am just a beginner so pardon me if i am wrong somewhere. Below is my JCL plz tell me if i am wrong somewhere

//$REXXB1 JOB (0301,CO-04-21,022602,CLA,195,64628),'REXX1 JOB',
// MSGCLASS=T,NOTIFY=SINGA1
//*MAIN CLASS=S4,USER=SINGA1
//*
//STEP010 EXEC PGM=IKJEFT01,
// PARM='NEW'
//*
//SYSEXEC DD DSN=T030.WORK.DHEERAJ.REXX1,
// DISP=SHR
//*
//SYSTSIN DD *
/*
//*
//IN DD *
ID1
ID2
ID3
/*
//FILEOUT DD DSN=T030.WORK.DHEERAJ.REXX1.OUTFIL,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(5,5),RLSE),
// DCB=(RECFM=FB,LRECL=80)
//*
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*


And below is my REXX

/* REXX */

"EXECIO * DISKR IN (FINIS"
IDCOUNT = QUEUED()
DO I = 1 TO IDCOUNT
PULL IN.I .
ADDRESS TSO "WHOIS" IN.I
X = OUTTRAP('TRAP.')
END
X = OUTTRAP('OFF')
ADDRESS TSO "ALLOC FILE(TRAPDD) BLKSIZE(0) LRECL(80) NEW",
" SPACE(5,5) TRK RECFM(F,B) "
ADDRESS TSO 'EXECIO DISKW FILEOUT ( FINIS STEM TRAP.'



Please help me regarding this, I would be very much grateful to you people.
Dheeraj Sharma
 
Posts: 12
Joined: Mon Sep 30, 2013 1:55 pm
Has thanked: 8 times
Been thanked: 0 time

Re: Store the output of tso whois command using REXX

Postby Dheeraj Sharma » Thu Oct 03, 2013 10:14 am

Pardon me for one thing ...instead of TRAPDD it is FILEOUT while allocating the file in REXX
Dheeraj Sharma
 
Posts: 12
Joined: Mon Sep 30, 2013 1:55 pm
Has thanked: 8 times
Been thanked: 0 time

Re: Store the output of tso whois command using REXX

Postby Akatsukami » Thu Oct 03, 2013 3:54 pm

The thing that leaps to the eye is that the invocation of WHOIS is outside of the OUTTRAPs. Move it to between them.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Store the output of tso whois command using REXX

Postby Dheeraj Sharma » Thu Oct 03, 2013 4:22 pm

I have tried it inside also...still its not working
Dheeraj Sharma
 
Posts: 12
Joined: Mon Sep 30, 2013 1:55 pm
Has thanked: 8 times
Been thanked: 0 time

Re: Store the output of tso whois command using REXX

Postby Akatsukami » Thu Oct 03, 2013 4:30 pm

Then begin by adding a TRACE statement to your exec so that we and you can see how it is not working.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Store the output of tso whois command using REXX

Postby Dheeraj Sharma » Thu Oct 03, 2013 4:35 pm

Sorry for bothering you again. Can you plz tell me about TRACE statement
Dheeraj Sharma
 
Posts: 12
Joined: Mon Sep 30, 2013 1:55 pm
Has thanked: 8 times
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post