Verify the variables in Experssion with Working storage sec



IBM's Command List programming language & Restructured Extended Executor

Verify the variables in Experssion with Working storage sec

Postby prasanth G » Thu Sep 01, 2016 11:56 am

Hi ,
I want to verify whether the variables used in a arithmetic expression Is defined as COMP3 datatype in WSS
For example :
In this expression ( a + b ) * ( b + c ) = d
I want to find whether this variables ( a , b, c , d ) is defined as COMP3 in Working storage section or not.
If this variables are not defined using COMP3 means i want to error it Out.
prasanth G
 
Posts: 5
Joined: Tue Aug 16, 2016 3:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Verify the variables in Experssion with Working storage sec

 

Re: Verify the variables in Experssion with Working storage

Postby willy jensen » Thu Sep 01, 2016 12:52 pm

Are you sure that you are asking about REXX? Variables in REXX are undefined, the contents are evaluated and converted as needed when used.
willy jensen
 
Posts: 61
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 11 times

Re: Verify the variables in Experssion with Working storage

Postby enrico-sorichetti » Thu Sep 01, 2016 12:59 pm

psychic day was yesterday so the best guess as of today ...

You want to write a REXX script to analyse a cobol program,
extract the arithmetic expressions and check if the variables used are defined as COMP3

good luck!
nobody will waste time on such useless requirement
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times

Re: Verify the variables in Experssion with Working storage

Postby prasanth G » Thu Sep 01, 2016 2:15 pm

thanks enrico,
Exactly What you stated was correct " You want to write a REXX script to analyse a cobol program,
extract the arithmetic expressions and check if the variables used are defined as COMP3 "
please give some logic in REXX to resolve it.
prasanth G
 
Posts: 5
Joined: Tue Aug 16, 2016 3:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Verify the variables in Experssion with Working storage

Postby enrico-sorichetti » Thu Sep 01, 2016 3:20 pm

not to sound snotty, but

is the person who asked for it aware of
the difficulty of the task!
the time and the skills needed
??

the logic to be used is the logic of a language tokenizer/parser
in this case a subset of the COBOL grammar

too complicated to explain it on a forum
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times

Re: Verify the variables in Experssion with Working storage

Postby Pedro » Thu Sep 01, 2016 10:55 pm

My suggestion:

Read all of the records into a stem variable
Make three passes through the stem array
1. remove all comments
2. look for declare statements and use a variable to remember if it is COMP3 or not
3. look for stem rows that contain an '=' sign, which seem to be the ones that you are interested in
a. translate all of the special characters to blanks
b. analyze every word of the remaining text
Pedro Vera
User avatar
Pedro
 
Posts: 541
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 34 times

Re: Verify the variables in Experssion with Working storage

Postby Robert Sample » Fri Sep 02, 2016 2:08 am

I find that reading your problem statements raises a lot of questions in my mind:

- WHY do this at all? If it is for efficiency, your company has already wasted enough of your time that it is not likely to recoup the cost in the next 10 years -- and how much code have you written so far?
- Why only WORKING-STORAGE? Why not FILE or LINKAGE SECTION variables?
- What about variables used in subscripts or reference modification? They may be used in arithmetic operations but don't need to be COMP-3, necessarily.
- If there are any intrinsic functions in the code, are you aware that some of them mandate that COMP-3 variables NOT be used?
- If there are COMP-1 or COMP-2 variables being used, how can you convert them to COMP-3?
- Has any senior technical person at your company looked at this project to determine the amount of effort involved?
- WORKING-STORAGE variables may be involved in computations but are also part of report lines, so changing them to COMP-3 will render them unreadable -- has this been considered?
- Is this a one-time effort, or is the thought to keep using the code for years to come?

Based on what has been posted so far, I would think that this project is, at best, a bad idea. At worst, it is going to be a TERRIBLE idea with a really bad implementation.
Robert Sample
Global moderator
 
Posts: 3121
Joined: Sat Dec 19, 2009 8:32 pm
Location: Bellevue, Iowa
Has thanked: 1 time
Been thanked: 182 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post