IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need Help In Coding Rexx code


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu Jun 03, 2010 12:00 pm
Reply with quote

I have to compare 3 files. For that our design says to create a panel and send the file names to jcl and invoke the jcl from there itself.
I never worked on REXX till date. Please help me giving some sample code.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jun 03, 2010 1:04 pm
Reply with quote

Well, the first problem is your management giving you a task for which you are not prepared for. However, there is a lot of REXX code on the forum for you to look at. Also the manuals are all available from the manuals sticky at the top of the CLIST / REXX forum.

There will be far more involvement that just plain old REXX here, as almost certainly you will also need to invoke some of the ISPF services.

Which program / utility do you envisage to perform the file compares.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu Jun 03, 2010 1:13 pm
Reply with quote

The panel will look like below.
CDL PAL Verification

1 Extract 6000 / CDL 2300
2 Extract 6000 / PAL 3700
3 Extract 6000 / CDL 2300 / PAL 3700

Please enter your option [_1_]
Compare Invoice Y/N [_Y_]
Environment DEVL SYSI QA PROD [_D_]

Extract file:[____________________________________________________]

PAL file: [____________________________________________________]

CDL file: [____________________________________________________]

Invoice file:[____________________________________________________]


PF3 = EXIT, PF6= Process

when PF6 is processed it should pass the parm value (combination of option, compare invoice and environment to jcl) and jcl should get submitted. The jcl looks like below.
//P54xxxx JOB (CMP01),'P54G73',
// CLASS=1,MSGCLASS=X,NOTIFY=&SYSUID RESTART=PS15
//JOBLIB DD DSN=TSHRPD.PAL.LOADLIB,DISP=SHR
//*************************************************************
//PS01 EXEC PGM=ITPCMP2,parm=’xx’
//CDL DD DSN=xxxxxxxxxxxxxxxxxxx,
// DISP=SHR,DCB=BUFNO=30
//PAL DD DSN=xxxxxxxxxxxxxxxxxxx,
// DISP=SHR,DCB=BUFNO=30
//BILEXT DD DSN=xxxxxxxxxxxxxxxxxxx,
// DISP=SHR,DCB=BUFNO=30
//INVOICE DD DSN=xxxxxxxxxxxxxxxxxxx,
// DISP=SHR,DCB=BUFNO=30

//SYSTSPRT DD SYSOUT=*
//SYSOUT DD DSN=dummy
//SYSPRINT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//

what i require is is hw to code the same in REXX
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 03, 2010 4:40 pm
Reply with quote

Quote:
I never worked on REXX till date. Please help me giving some sample code.
This is a HELP forum, not a WRITE-YOUR-CODE-FOR-YOU forum. The responders are paid for their professional work product, which is what you are asking for. Unless you are willing to pay for the code (and 1000 U.S. dollars and up per day is common), please do not ask for code. There are plenty of code examples posted on the forum but they were donated.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu Jun 03, 2010 4:45 pm
Reply with quote

Thanks for not helping... Bye
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jun 03, 2010 5:03 pm
Reply with quote

Quote:
Thanks for not helping... Bye


sarcasm will get You nowhere,
and certainly will not get You any help
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu Jun 03, 2010 5:11 pm
Reply with quote

Oh okay ,,, Thanks ,, bye
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 03, 2010 5:27 pm
Reply with quote

you ever notice how these children who say
'you have not helped me!!!!'
'I am going away and never coming back'


But they always stick around
and whine like a baby
when any comment is made about their childish behavior.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jun 03, 2010 5:57 pm
Reply with quote

the whole ISPF shebang
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/ISPZPM61

the whole REXX shebang
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK80

the ISPF PRIMER ... old but still useful
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ISRVPB01/CONTENTS?SHELF=&DT=19931028105440
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Jun 03, 2010 6:23 pm
Reply with quote

Just in case you're sticking around...

You will need a small rexx program that will:
- display the panel,
- terminate if PF3 was hit,
- validate the data,
- merge the data into a JCL (that's called File Tailoring),
- submit the job

Show me that you have made an effort:
- look for panel definition examples,
- draw your own panel,
- write a small rexx that display the panel,
- show us the results,
then you will get more help.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 11:35 am
Reply with quote

PANEL:-

)ATTR
$ TYPE(TEXT) SKIP(ON) intens(low) color(yellow)
# TYPE(TEXT) SKIP(ON) color(blue)
_ CAPS(ON) PAD('_')
¬ CAPS(OFF) PAD('_')
! TYPE(INPUT) CAPS(OFF) JUST(LEFT) PAD(NULLS) INTENS(LOW)
¢ TYPE(OUTPUT) CAPS(OFF) JUST(LEFT) PAD(' ')
)BODY WINDOW(74,18) EXPAND(\\)
$ CDL PAL VERIFICATION
$ -------------------------
%
# [1] EXTRACT 6000 / CDL 2300
# [2] EXTRACT 6000 / PAL 3700
# [3] EXTRACT 6000 / CDL 2300 / PAL 3700
%
% Please Enter Your Option : !A1$
% Compare With Invoice File Y/N : !B1$
% Environment DEV(D)SYSI(S)/QAHQQ)/PRODHPP): !C1$
% Extract File:!input1 $
% HPP ALAL File :!input2 $
% CDADLAL File :!input3 $
% Invoice File:!input4 $
$Message --->!SkyMsg $<
%
%
% <F6>+Send Page %<F3>+Do NOT Send
)INIT
.cursor = 'a1'
)PROC
&PFKEY = .PFKEY
emsgg = ' '
)END

CODE:-
/* rexx */
trace on
/* +++++++++++ TESTING ++++++++++++++ */
panellibb = tshrpddHPp5czz6.rexx.panel'
clistlibb = tshrpddHPp5czz6.rexx.clist'
trace on
address ISPEXEC
"control errors return"
sysenv =sysvarr(sysenvv')
sysuid =sysvarr('sysuid')
address TSO ALTLIBB ACTIVATE APPLICATION(EXEC) DSN('clistlibb"')"
if recc ¬= 0) then do
say ALTLIBB ACT failed,recc=recc
exit 99
end
"LIBDEF ISPPLIBDATASETT ID('panellibb"')"
ispskell =tshrpdpHP.p54gz6.proclib'
"LIBDEF ISPSLIB DATASET ID('"ispskel"')"
/* ------------------------------------------------------------ */
address ISPEXEC
emsg = ''
"DISPLAY PANEL(TEST1V)"
ADDRESS ISPEXEC "VGET (ZPFKEY) ASIS"
ZPF06_SAVE = ZPF06
ZPF06 = DoprefixExecute
"VPUT (ZPF06) PROFILE"
SELECT
WHEN ZPFKEY = 'PF03' THEN
say "byeeeeeeeeeeeee"
WHEN (ZPFKEY = 'PF06' | ZPFKEY = 'ENTER') THEN
SETMSG "SkuMsg(Hi....)"
OTHERWISE
EXIT
END

Thanks enrico-sorichetti. The links shared helping me a lot. Now I am facing problem in implementing the keys. I am using PF03 key to exit from the screen(is working fine) and PF06 as process key but when i press PF06 its giving msg on the right top saying "RCHANGE is allowed"
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jun 15, 2010 11:48 am
Reply with quote

why bother with pfkeys...
use ENTER to proceed PF3 to exit
that' the general suggested way of doing it
( never had the need to use anything else )

You might also setup a further panel to ask for confirmation
( ENTER PF3 as usual ) that could be disabled per user preference
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 15, 2010 11:51 am
Reply with quote

Why this obsession with using PF keys to signal OK. What is wrong with good old "ENTER"
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 12:08 pm
Reply with quote

Ok I try implement the same. Is it required to code PFKEYS validations in program or it going to happen automatically.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jun 15, 2010 12:14 pm
Reply with quote

Quote:
Is it required to code PFKEYS validations in program or it going to happen automatically.

You do not have to do any validation... You just need to check the return codes after a panel display

RC=8 User requested termination via the END or RETURN command
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 12:50 pm
Reply with quote

How to validate the enterered option on the screen in rexx code?

is the below way is correct:

option = a1 /* taking the value from screen variable */
if (option \= 1) or (option \= 2) or (option \= 3) then
do
skumsg = 'invalid option entered'
end

is this works?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 15, 2010 12:53 pm
Reply with quote

No. Think about exactly what your logic is doing. Try to follow it through using Option = 2 as an example.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 1:00 pm
Reply with quote

Used ENTER key in the panel.

Panel:
% Please Enter Your Option : !A1$

Code:
Code:
ADDRESS ISPEXEC "VGET (ZPFKEY) ASES"                     
IF REC \= 0 THEN                                         
DO                                                       
  SAY "TERMINATED ABNORMALLY"                           
END                                                     
IFPFKEYY = PFUIF03' THEN                                   
  SAY "GOOD BYE.."                                       
  EXIT                                                   
OPTION = A1                                             
IF (OPTION \= 01) | (OPTION \= 02) | (OPTION \= 03) THEN
   SAY "INVALID OPTION ENTERED"                         
ELSE                                                     
KNOP NOP                                                   
EXIT             


I am expecting and validating the option field as above in my code. When option 07 is given and press <ENTER> key, witout giving any message the control is coming out from the REXX screen. Please let me know where am doing wrong
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 15, 2010 1:22 pm
Reply with quote

As you appear to have done some reading and made your own efforts, here is some code that I use
Code:
DO FOREVER
  "ISPEXEC DISPLAY PANEL(AAAAMAIN)"
 
  IF RC = 8 | ZCMD = 'x' | ZCMD = 'X'
     THEN EXIT

  ERRMSG1 = " "
  ERRMSG2 = " "
  ERRMSG3 = " "

  RTYP = ZCMD
  ZCMD = ' '

  IF RTYP = 'a' | RTYP = 'A' THEN DO
     CALL AAAA_DSN                           
     INDSNAME = " "                           
  END                                         
  ELSE IF RTYP = 'b' | RTYP = 'B' THEN DO     
     PANID = "AAAATAB1"                                         
     ROWSEL = 0                                                 
     ROWOUT = 0                                                 
     CALL AAAA_PAN                                               
  END                                                           
  ELSE IF RTYP = 'c' | RTYP = 'C' THEN DO                       
     PANID = "AAAATAB2"                                         
     ROWSEL = 0                                                 
     ROWOUT = 0                                                 
     CALL AAAA_REP                                               
  END                                                           
  ELSE DO                                                       
     ERRMSG1 = "INVALID SELECTION - "RTYP" - PLEASE RESPECIFY"   
     RTYP = " "                                                 
     RESULT = 4                                                 
  END                                                           
                                   
  IF RESULT <> 0 THEN ITERATE       

  The rest of the code follows here

END
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jun 15, 2010 1:30 pm
Reply with quote

Code:
% PLEASE ENTER YOUR OPTION : !A1$     
% COMPARE WITH INVOICE FILE Y/N : !B1$

When you have to define an input field of one character you can use the Z placeholder:
Code:
% PLEASE ENTER YOUR OPTION : !Z$     
% COMPARE WITH INVOICE FILE Y/N : !Z$
...
)INIT             
 .ZVARS = '(OPTION INVOICE)'
ISPF will replace each Z in the )BODY section by the corresponding name in the .ZVARS (1st Z get 1st name, 2nd Z gets 2nd name and so on).
Of course, this happens only if the Z char is in an input or output field.

You can validate most on the fields in the )PROC section. Try this:
Code:
)PROC
  VER(&OPTION,NB,LIST,1,2,3)
  VER(&INVOICE,NB,LIST,Y,N)
  VER(&INPUT1,NB,DSNAME)

As you will see, you do not need to define a field for messages.
Let ISPF handle this for you, it will be easier.
Later, you will learn how to create messages of your own.

Check all statements in the book
You can do more interesting validations:
Code:
  IF (&INVOICE = Y)
     VER(&INPUT4,NB,DSNAME)
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jun 15, 2010 1:46 pm
Reply with quote

You may want to use CAPS(ON) on you input fields too, so that you don't have to check for 'y' and 'Y'.

There is a lot of typos in your posts. Try to copy and paste the text.
Use BBCode too, it makes it much easier for everybody.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 4:07 pm
Reply with quote

Marso.. Thanks a lot.

Now panel definition look like below. Only thing is Message field is unprotected. I want make that field protected, as I want use this field only to send the user defined messages or any other meassages. Please guide me how to achive that
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 4:21 pm
Reply with quote

I achieved that by using below code in panel.

$MESSAGE --->+!Z


Is this is correct. Now the message field is protected. And I defined Z variable for the same in )INIT section.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Jun 15, 2010 7:38 pm
Reply with quote

Not bad for your first project. But your color scheme is not consistent with ISPF.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Tue Jun 15, 2010 9:13 pm
Reply with quote

Thanks Pedro. I am trying to pass the dsn names to jcl. but it replacing the skelton with empty screen. I am not getting where I am doing wrong . Actually i have to pass user id also.. but first i am trying to pass atleast dataset names to the jcl. Please find the attched code and skelton and guide me where i am doing wrong
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top