READ and READ(E) differ in RPGLE opcode

3790 pts.
Tags:
RPGLE opcode
1) what the different between read and read(e) in rpgle opcode.
2) what the different between write and write(e) in rpgle opcode..
if you have any scenario, show me....


Software/Hardware used:
as400 v5r3

Answer Wiki

Thanks. We'll let you know when a new response is added.

To handle exceptions (program status codes 401-421, 431, or 432), either the operation code extender ‘E’ or an error indicator ER can be specified, but not both. For more information on error handling, see Program Exception/Errors.

Discuss This Question: 12  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb
    You haven't done your share. Try: rpg programmers guide, search for (e) Try GOOGLE AS/400 RPGLE "READ(e)" Ask questions after you have made a serious effort on your own.
    54,090 pointsBadges:
    report
  • pdsathishkumar
    can we use READ(E) and WRITE(E) in PF using RPGLE program....
    3,790 pointsBadges:
    report
  • deepu9321
    Yeah, We can use READ(E) & WRITE(E). Only the difference between READ & READ(E) is for handling the exception. Pradeep.
    4,955 pointsBadges:
    report
  • pdsathishkumar
    your r correct Mr. Pradeep, while i using the read opcode, i got one error cpf4737.. after i using read(e) opcode, error didn't show.... if you have any scenario for pf in rpgle using read(e) or write(e)
    3,790 pointsBadges:
    report
  • deepu9321
    if you have any scenario for pf in rpgle using read(e) or write(e) I didnt get you exactly, Are you looking for examples or You got the required result already? Pradeep.
    4,955 pointsBadges:
    report
  • philpl1jb
    sathish This will be the end of my participation on your questions. You do too little and expect too much. I'm sure you will find others to do your work. Phil
    54,090 pointsBadges:
    report
  • pdsathishkumar
    Alright Mr. Phil, because i am beginner of AS400.. i have lot of interest in AS400.. i searched in Google about my topic... i didn't get clear solution... so only i asked and i want an exact suggestion... so, don't mistake me.....
    3,790 pointsBadges:
    report
  • TomLiotta
    while i using the read opcode, i got one error cpf4737.. after i using read(e) opcode, error didn’t show…. There are actually three forms of the READ op-code -- READ by itself, READ with an error indicator and READ with the (E) extender. Did you try all three? Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Neither the op-code extender nor an ER indicator is required for handling exceptions. However, both of those can make exception-handling easier and/or more visible. -- Tom
    125,585 pointsBadges:
    report
  • huihi75
    philpl1jb is a chooth! He should be willing to share his knowledge in these forum if he wants to take part!
    10 pointsBadges:
    report
  • TheRealRaven
    That may be, though I definitely disagree. This forum isn't intended to give training courses. If you read the site FAQ, you should understand more about what questions are a good fit here.

    In the case of this question, the answer is already in the language reference manual, and that's where it should be found. There is no reason simply to copy from the language reference to here. That just adds another copy of the same info on the internet.

    By answering each individual question that doesn't ask about a technical problem, this forum becomes useless for its intended members. It becomes another low-quality forum like Yahoo!, and the actual "IT professionals" who should be using this site will simply go somewhere else.

    The more that happens, the less value the site will have. (Actually, that seems not far from the current status judging by the quality of most questions.)
    22,380 pointsBadges:
    report
  • anandx
    Read operation can result in one of following conditions: (a) %found condition: fetches next record from where file ptr is currently and pointer is placed in the new rec after successful read (b) %eof condition: no record fetched, pointer will be at eof and any new attempt to access dbf needs repositioning of ptr using, setll/gt, chain. readP will not work after eof is hit  (c) record locked condition: the system will reattempt reading the same rec again until the time as specified in WAITREC param in file desc expires, and if fails even after that rcd lock err/excp msg gets issued
    (d) %error condition: an expected error condition such as file itself not opened yet...
    in scenario other than the first listed earlier  'read' will invite rpg def err/exc handler to take control and  'Read(e)' will make def err handler relinquish control to pgm  to handle error and if it ignores taking actions then pgm will move to next statement and correctness of further processing will be unpredictable.
    When usage clause in F-spec is defined as *input, then read is always without lock and can read a locked rec. When usage is either *update or *delete, 'read' is with lock and read(N) is without lock. 
    Prior to update or delete operation, 'chain' (with lock), update/delete and if update/delete fails, release lock explicitly
    To summarize, when error occurs in reading,'read' gives control to rpg default error handler and read(e) gives the control to pgm 

    625 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: