Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Rexx code to find greater then symobl ">" in a cobol program

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Bharath Vikraman

New User


Joined: 06 Aug 2017
Posts: 9
Location: India

PostPosted: Tue May 29, 2018 9:40 am    Post subject: Rexx code to find greater then symobl ">" in a cobol program
Reply with quote

Hi All,

I have an requirement to find the usage of greater than operator ( > ) in a Cobol program. So I have used a logic like -->

1) Get the starting line number of procedure division and the ending line number of the procedure division.

2) check each line for existence of ">" symbol if found print that line.

For this I have used the REXX code as -->
Code:

count = 1 /* initialize record counter */

do while count <= input.0 /* loop through records */

after = ‘ ‘

parse UPPER var input.count . ‘>’ after

if after ^= ‘ ‘ then,

say input.count /* list the record */

count = count + 1 /* increment the record counter*/

end /* end of loop */

3) Now my doubt is-->

If there are some IF condition in the program like-->

If A
>
b

Here what we should do to check the previous line of the greater than symbol found if there is no any arithmetic operators or conditional expressions found before the ">" symbol in the same line?

In this case I need all the three lines to be printed.


I hope my question is clear.
Back to top
View user's profile Send private message

expat

Global Moderator


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

PostPosted: Tue May 29, 2018 11:44 am    Post subject:
Reply with quote

I have put your stuff into the correct code tags, see below for next time -
Code:
 [code] your stuff [/code]


Why use REXX, why not use the built in search utility ?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1121
Location: Vilnius, Lithuania

PostPosted: Tue May 29, 2018 12:28 pm    Post subject:
Reply with quote

And which PHB came up with this, frankly imbecile, "requirement"?
Back to top
View user's profile Send private message
Bharath Vikraman

New User


Joined: 06 Aug 2017
Posts: 9
Location: India

PostPosted: Tue May 29, 2018 12:51 pm    Post subject:
Reply with quote

Thanks for the reply. Could you please let us know how we can fetch the characters from previous or next line using the search utility??
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 251
Location: Denmark

PostPosted: Tue May 29, 2018 1:29 pm    Post subject:
Reply with quote

without wanting to get into a discussion of why, here is a possible how (from the top of my head, not tested):

Code:

do n=1 to input.0
  if pos('>',input.n)=0 then iterate
  if strip(input.n)='>' then do
    say Value('input.'n-1)
    say input.n
    say Value('input.'n+1)
  end
  else say input.n
end

this assumes that a single '>' is not found in the first nor the last line.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 29, 2018 4:38 pm    Post subject:
Reply with quote

Bharath Vikraman wrote:
Thanks for the reply. Could you please let us know how we can fetch the characters from previous or next line using the search utility??


Why just the next line ???
Code:

If
A
>
B
Then do
    other code here
End


All you are doing is finding the occurrence of a given string.

I would guess that when a string is found some decision has to be made as to what happens within the confines of the string, or statement, which contains said occurrence, depending on the contents of that statement other options may be needed.

So to me, a quick run through at eyeball level would be the best way to start, knowing where the string occurs.

So I could suggest that on each and every occurrence you will need to flow backwards to the last code delimiter, i.e. the full stop, and then increment forward to the next delimiter.

Obviously you will need to know where exactly within the stem are so as not to encounter an "out of bounds" problem.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1303
Location: Israel

PostPosted: Wed May 30, 2018 3:44 pm    Post subject:
Reply with quote

What about this:
Code:
    DISPLAY 'Before something: <' DATA-IN '>'
    PERFORM something
    DISPLAY 'After something: <' DATA-OUT '>'

or this:
Code:
    IF MY-NUMBER < 10 THEN
        whatever
    ELSE
        DISPLAY 'greater than 9'
    END-IF
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1121
Location: Vilnius, Lithuania

PostPosted: Wed May 30, 2018 6:46 pm    Post subject:
Reply with quote

Please lock this topic, the requirement is a load of bollocks!

Code:
"isredit macro"
"isredit x all"
"isredit f '>' all"
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball
call eye_ball

There, in a nutshell, you have the code I wrote at a former client to solve the Y2K problem.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed May 30, 2018 7:52 pm    Post subject:
Reply with quote

Have to agree with Prino ......................... LOCKED
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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
No new posts How to process gdg in rexx program wh... pkmurali CLIST & REXX 11 Thu Dec 13, 2018 10:08 am
No new posts CICS program with Delay question MSTP CICS 2 Tue Dec 11, 2018 11:18 pm
No new posts COBOL D2 program execution without us... dipsybaby DB2 3 Mon Dec 10, 2018 2:08 pm
No new posts calling java code(on mainframe from c... elixir1986 COBOL Programming 1 Fri Nov 30, 2018 1:57 am
No new posts Need advise in calling DFSORT from REXX ajithajt CLIST & REXX 9 Thu Nov 29, 2018 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us