Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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: 264

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: 759
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: 10632
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 Member


Joined: 29 Apr 2008
Posts: 609
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: 10632
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: 264

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: 2247
Location: Hampshire, 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: 10632
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: 2247
Location: Hampshire, 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 File transfer issue with end of line ... VINAY PALLELA TSO/ISPF 4 Thu Nov 14, 2019 12:01 am
No new posts Extract data from n DB2 Views automat... esmeraldo All Other Mainframe Topics 4 Wed Nov 13, 2019 12:32 am
No new posts File compare, where file has header a... VINAY PALLELA SYNCSORT 8 Thu Nov 07, 2019 5:05 pm
No new posts Can you manually set an EOF marker in... Don Allard CLIST & REXX 5 Sat Nov 02, 2019 12:30 am
No new posts OMIT first and last column of a pipe-... karthikb_itpro DFSORT/ICETOOL 1 Fri Nov 01, 2019 8:24 pm

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