AS/400 – Multiple occurrence data structure

450 pts.
Tags:
AS 400
What is the use if Multiple occurrence data structure? OCCRUS opcode usage - I'm not understanding the concept so please help me.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  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.
  • ToddN2000
    The occurs means the data structure functions more like a table. We have a few programs that will load these multi occurrence data structures and then 'DO' loop through them for processing later to improve performance.
    132,640 pointsBadges:
    report
  • azohawk

    Essentially a multiple occurance data structure is a 2 dimensianal array, common in many other languages. Until the capability to perform multiple orruance data structures came along, there really was not way to do this.

    I can recall using this just a few times (2 maybe 3 times) in my career (20+ years).  So it is not something that is used very often.

    When I have used it, I was retrieving data from a file that was not organized to have a nice level break type program.

    The one I recall the best: The goal was basically to have the summary of a level break program without the detail. Essentially a summary report grouped by factory location, within each factory the type of order, then the press, spread accross various time frames (over due, due this week, next week, week after, 30 days, 60 days, 90 days, etc.). All of the data was in seperate files with no good way to create a join for all of the files. So I would process an order, using  the multiple occruance array to determine which occurance the job was to be applied to (factory, order type, press-think rows) then I put the data into a date bucket for the right bucket in the data structure (think columns).

    I suppose I could have done this with a work file, but at the time this approach seemed a better way to go.  This program replaced a series of SQL procedures that produced information in a series non-meaningful reports; that program took 12 minutes to run.  My program ran in 90 seconds and provided a more useful report that users loved.  Both ran as scheduled jobs and spit out the report every morning that someone else had the responsibility to copy and manually put on users desks (this was about 20 years ago on a v4 machine).  Would I do things differntly today, very likely.

    The other time I recall using a multiple occurance data structure was a similar situation, but there are too many miles since that bridge, so I don't recall the specifics.


    4,055 pointsBadges:
    report
  • ToddN2000
    @azohawk: I don't think i have written them since my RPG II days back in the early 80's. I do have to maintain some legacy code and software packages we have bought over the years that still use them..
    RPG has come a long way since the L1,L2,L3 and H1 breaks and halts. I don't think I have seen a program that was input primary, no keys and used the normal RPG cycle in at least a decade or more..
    132,640 pointsBadges:
    report
  • azohawk

    @ToddN2000, I was still a relatively inexperienced programmer when I wrote those, but have never written a program for production that used the cycle and never written one that used L1, L2 etc. since a college course.

    I have written a few update programs that used the cycle that were quick and dirty when I didn't trust my SQL skills to make the changes. But they were one-off programs.

    I don't recall ever seeing a program written by someone else that used a MODS.

    4,055 pointsBadges:
    report
  • GregManzo
    Nostalgia isn't what it used to be...
    Another use for multi-occurrence is for loading a cache of records into a MODS based on an external file structure. If you are processing a large number of transactions that require data from a reference or control file, but potentially a different record for each transaction, then a cache can be faster that re-Chaining to the relevant record each time.
    2,960 pointsBadges:
    report
  • TheRealRaven
    I use them for FETCH myviewcursor FOR n ROWS more than anything else nowadays. Declare a MODS for OCCURS( n ) EXTNAME( myview )  and fetch blocks of records at a time. The MODS can then source a subfile or other output feature.

    But this really shouldn't be an appropriate question. Tutoring one individual leads to a second posting basic learning questions, then a third, then entire classrooms, etc. It simply can't be maintained.
    35,060 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: