Page 1 of 1

Verify the variables in Experssion with Working storage sec

PostPosted: Thu Sep 01, 2016 11:56 am
by prasanth G
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.

Re: Verify the variables in Experssion with Working storage

PostPosted: Thu Sep 01, 2016 12:52 pm
by willy jensen
Are you sure that you are asking about REXX? Variables in REXX are undefined, the contents are evaluated and converted as needed when used.

Re: Verify the variables in Experssion with Working storage

PostPosted: Thu Sep 01, 2016 12:59 pm
by enrico-sorichetti
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

Re: Verify the variables in Experssion with Working storage

PostPosted: Thu Sep 01, 2016 2:15 pm
by prasanth G
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.

Re: Verify the variables in Experssion with Working storage

PostPosted: Thu Sep 01, 2016 3:20 pm
by enrico-sorichetti
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

Re: Verify the variables in Experssion with Working storage

PostPosted: Thu Sep 01, 2016 10:55 pm
by Pedro
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

Re: Verify the variables in Experssion with Working storage

PostPosted: Fri Sep 02, 2016 2:08 am
by Robert Sample
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.