Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help for a first time Rexx user

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Unshriven

New User


Joined: 04 Jan 2010
Posts: 7
Location: Dallas

PostPosted: Tue Jan 10, 2012 10:49 pm    Post subject: Help for a first time Rexx user
Reply with quote

I'm been tasked to write a Rexx program to check a file. I've never used Rexx and am a bit lost but I had this foisted on my because I expressed interest in learning Rexx. My task is this:

Read 4 sequential datasets
check the value in a certain column of each
if the value is not 0000 then copy that record to a temp dataset (and add each exception to that dataset)
when all 4 datasets have been read write the file if the program has found exceptions, otherwise exit and do nothing.

I've been given access to a list of existing Rexx programs as an example. To me, it's like saying "Here's War and Peace" by the end of the week you should be reading Russian. Yes, I'm reading the tutorials and it's very slow going. I don't have any other programming experience.

Any samples, guidance or suggestions (examples) would be greatly appreciated.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 10, 2012 10:57 pm    Post subject:
Reply with quote

Yes, tell them that your sort product would be far more efficient than using REXX
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 10, 2012 11:05 pm    Post subject:
Reply with quote

If im right there is another forum for students like you.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jan 10, 2012 11:13 pm    Post subject:
Reply with quote

Depending on the size of the input data sets, performance may range from adequate to execrable; you have been warned.

I don't entirely understand
Quote:
if the value is not 0000 then copy that record to a temp dataset (and add each exception to that dataset)
when all 4 datasets have been read write the file if the program has found exceptions, otherwise exit and do nothing.


As you may already know, Rexx has no facility for allocating data sets and files. Assuming that you are running this in the background (i.e., in batch), you can either allocate them statically in the JCL, or dynamically by means of the TSO ALLOCATE command, if you're executing the TMP (IKJEFT*) or have established a TSO environment.

I/O is done with the EXECIO command. Use the SUBSTR function, the INDEX function, and/or the POS function to select and search the proper positions in each record. Remember that all Rexx variables are character strings, and there are therefore no true Boolean variables; IMNSHO, it is better to code
Code:
flag = val
if (flag=1) then do

than
Code:
flag = val
if (flag) then do

since flag cannot be restricted to having either zero or one as valuers.
Back to top
View user's profile Send private message
Unshriven

New User


Joined: 04 Jan 2010
Posts: 7
Location: Dallas

PostPosted: Tue Jan 10, 2012 11:24 pm    Post subject:
Reply with quote

No, I didn't know Rexx can't write datasets. Also, remember, I'm relaying what I was told by my boss so if I describe it inaccurately, I apologize.

The situation is that I've been given a batch job that does 4 queries against a dataset then it produces 4 datasets. In one of the columns of the dataset, there is a flag that should be set to 0000 (this shows that one of the aspects of the facilities we're looking at has been reset). If the value has not been reset, it retains it's last value (not 0). If that is the case, then I need that record written out to another dataset (my boss told me Rexx can write it to a temp file then at the end 'writeall' to allocate the dataset). Then this dataset will be emailed out to be checked. If there are no exceptions, nothing is sent.
I don't know if this is the easiest way to do it. Some others at work have suggested sort but I've been told to do it in Rexx.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jan 10, 2012 11:31 pm    Post subject: Reply to: Help for a first time Rexx user
Reply with quote

Quote:
Some others at work have suggested sort but I've been told to do it in Rexx.


You were not told.... You asked to be told...

being unskilled in REXX means that just helping You with the logic will just lead nowhere

You will need full spoonfeeding for each rexx statement to be used, and this is not help... is something completely different

also , repeating for the zillionth time, REXX is not the proper choice for processing large amounts of records.

use Your sort product...
Back to top
View user's profile Send private message
Unshriven

New User


Joined: 04 Jan 2010
Posts: 7
Location: Dallas

PostPosted: Tue Jan 10, 2012 11:36 pm    Post subject: Reply to: Help for a first time Rexx user
Reply with quote

I agree but my shop loves the whole "let's throw them to the wolves" mentality in training. I particularly think it's the most horrid, in efficient means to train anyone but they really don't want my opinion.

As for being told, yes I said sort may be a better choice and the response was "yeah, maybe, but you're going to do it in Rexx". so yes, I was 'told'.

I hate having to be spoon fed, I hate the fact that I was given a production job to learn on that has a strict time limit. Good choice but that's what I have to live with.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jan 10, 2012 11:56 pm    Post subject:
Reply with quote

Unshriven wrote:
No, I didn't know Rexx can't write datasets.

It can write data sets (if we consider the EXECIO command part of Rexx), it can't allocate them.

If you were writing a COBOL program, you would probably write something like:
Code:
     ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
      *
           SELECT A-FILE      ASSIGN TO UT-S-FOO.

and
Code:
READ FOO AT END
                some stuff.

When you executed it, your JCL would look like
Code:
//STEPNN   EXEC   PGM=RORA
//FOO      DD     DSN=BAR,DISP=SHR

The file FOO is associated withe data set BAR by the JCL (that's what JCL does, not sort records, copy one PDS to another, or any of the myriad misconceptions that too many querents have). In Rexx, you would write:
Code:
EXECIO 1 DISKR FOO
pull record

and the JCL would be
Code:
//STEPNN   EXEC   PGM=IRXJCL,PARM='RORA'
//FOO     DD     DSN=BAR,DISP=SHR

Alternatively, as I've said, if you're established a TSO environment, you could code
Code:
"ALLOC FI(FOO) DA('BAR') SHR"
"EXECIO 1 DISKR FOO"
pull record
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Jan 11, 2012 1:27 am    Post subject: Reply to: Help for a first time Rexx user
Reply with quote

Quote:
Rexx can write it to a temp file then at the end 'writeall' to allocate the dataset


I suggest that you save any records you want to write to a rexx stem variable and then when you are done to use EXECIO to write the entire stem to your file.

So, find the rexx reference manual and read up on rexx stem variables and EXECIO syntax.
Back to top
View user's profile Send private message
Unshriven

New User


Joined: 04 Jan 2010
Posts: 7
Location: Dallas

PostPosted: Wed Jan 11, 2012 1:29 am    Post subject:
Reply with quote

I appreciate everyone's help. I'm going back to him and saying this is not working. The first time I should at least be shown. I'll let everyone know how it works out.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Jan 11, 2012 5:14 am    Post subject: Reply to: Help for a first time Rexx user
Reply with quote

Start with this program, then add to it:
Code:
/* rexx */
Say 'Hello World!'
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 11, 2012 1:32 pm    Post subject:
Reply with quote

I suppose that you could really show them, and use REXX to invoke SORT to do the processing icon_lol.gif
Back to top
View user's profile Send private message
chaoj

Active User


Joined: 03 Jun 2010
Posts: 103
Location: Dalian

PostPosted: Wed Jan 11, 2012 2:57 pm    Post subject: Re: Help for a first time Rexx user
Reply with quote

Unshriven wrote:
I've been given access to a list of existing Rexx programs as an example.


You're so lucky and could read sample rexx code, I learn rexx from its name : rexx , rexx what ? who knows , like the TSO's ready , ready for what ?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jan 11, 2012 7:12 pm    Post subject:
Reply with quote

Quote:
I don't have any other programming experience.
If that's the case - possibly start by writing a pseudo code, irrespective of which language to use - and then try to use the language of your choice. Logics are universal, most of the times.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us