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
 
Will this code extract 1 byte from file using rexx?

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

Active User


Joined: 15 Dec 2005
Posts: 257

PostPosted: Sat Nov 10, 2018 11:13 pm    Post subject: Will this code extract 1 byte from file using rexx?
Reply with quote

Dear all

Please validate whether the below piece of code will extract 1 byte f rtom file using rexx

Code:

"EXECIO * DISKR MYINDD (FINIS STEM MYVAR"
DO i = 1 to MYVAR0
   this_line = VALUE('MYVAR'||i)
END"

Do i = 1 to myvar.n /* to get the record */
   If i< myvar.n then
   Do
      Do j = 1 to 500
         X=substr(myvar.n,1,i) /* to get the 1 byte of record*/
      End
   End
End


code reformatted to give decent indentation
Back to top
View user's profile Send private message

steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 681
Location: The Universe

PostPosted: Sun Nov 11, 2018 12:15 am    Post subject:
Reply with quote

What happened when you ran it?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10541
Location: italy

PostPosted: Sun Nov 11, 2018 3:05 am    Post subject:
Reply with quote

the code snippet You posted does not make any sense

try with

Code:
"EXECIO * DISKR MYINDD (FINIS STEM MYVAR."

pos = 1
do i = 1 to myvar.0
    say "line" i ", pos" pos "'"substr(myvar.i,pos,1)"'"
end
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Sun Nov 11, 2018 5:50 am    Post subject:
Reply with quote

In order to extract one byte, there is absolutely no need to read all records. Especially when file size can be 100,000,000 records. Especially doing this senseless activity in one shot, into single stem (in the memory!!!)
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10541
Location: italy

PostPosted: Sun Nov 11, 2018 5:58 am    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

from the number of do statements it seemed clear that the TS wanted to extract 1 byte from each record...

I am really tired of talking about good practices, when most people do not care about them.
if I feel in the mood I provide some hints, otherwise I just ignore the topic
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 257

PostPosted: Sun Nov 11, 2018 7:13 am    Post subject:
Reply with quote

Enrico is right. Need to extract 1byte from each record.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Sun Nov 11, 2018 1:38 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

Why do you need someone to verify it your code? Why can you not do it yourself? A simple test data set (not file) with one record and LRECL of 10, for example, would show if your code worked or not.

How many records in your input data set? And LRECL?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10541
Location: italy

PostPosted: Sun Nov 11, 2018 3:31 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

no reformatting will make a bad snippet good icon_cool.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Sun Nov 11, 2018 8:00 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

Quote:
no reformatting will make a bad snippet good

True - but it makes it easier to see how bad it is.
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
No new posts How to process gdg in rexx program wh... pkmurali CLIST & REXX 0 Thu Dec 13, 2018 10:08 am
No new posts Transferring file to Mainframes Shinoj Vijayakumar IBM Tools 3 Thu Dec 06, 2018 2:35 pm
No new posts Convert VBA file to FB! Vignesh Sid SYNCSORT 5 Mon Dec 03, 2018 1:27 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