Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Are RPG Subroutines Obsolete?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Are RPG Subroutines Obsolete?

    I don't think Subroutines should be going obsolete. I don't see how a subprocedure would handle being reused over and over for an operation. Now I am always open for a change so if I am wrong and this can be done in a subprocedure then please, I'm all ears I am looking through the IBM RPGILE V5R1 manual and so far I don't see it useful. What I do in conversions, is when a new client hospital gives us there data files that needs to be converted from their old vendors system to our system, I will write subroutines in the conversion to excute to, do perform the changes and exit out with the information needed and proceed on. For example building some of the files I will need to validate and clean up patients name, guarantor name, contact 1 information, contact 2 information ,next of kin, father and mother names. Rather than repeating my code over and over which only clutters things up I inz at the beginning of my code all my hold and work fields. Then say a field name cvpname is my incoming field, ipname and opname are the fields I am using for the subroutine where ipanme is in name and opname is out name fields. I would then eval ipname = %triml(cvpname) to be sure its fully left justified in the field first off which sometimes on free texted incoming systems the client may have like 3 or more blanks then the name. THen I exsr namesub. . .not going to put the code of the subroutine but it basically puts the full name into an array and pulls out first and last name out of it. Also converts lower characters to upper and extracts out special characters. And then I movel into the opname field and endsr. It relays back where i exsr the subroutine and does a movel opname to pname which is our field. And then for the other fields just eval to the ipname, exsr namesub, move to correct field on our system. And btw I reinz the hold/work fields at end of subroutine as well. At beginning of subroutine I reclear the opname as well. And thats about it. I also use subroutines to handle phone numbers and date changes as well, as to converting to iso dates that is. We have dates as date of birth, admission date, discharge date, procedure 1 thru 7 dates, date of final bill, date abstracted, date of last statement, date of lasy payment, and so on. SO many date fields. Again why duplicate code when a subroutine handles it. Now Subprocedures are new to me so it may can do the same, I don't know. If you can provide some sort of example how you can call out to it, perform my normal changes, then return the vaule back as the subroutines do then I would be grateful Just confused Thanks

  • #2
    Are RPG Subroutines Obsolete?

    I have cobbled together an example of how you might split a full name into its component parts using procedures instead of subroutines. I am attaching it to this comment. You can do everything you want in a subroutine but I prefer procedures because they have a formal interface which the compiler will complain about if you don't call it correctly which catches some common errors at compile time and not runtime. You can also put these procedures in a service program and have as many programs call them as needed without having to duplicate a subroutine in hundreds of programs. The example I have written may not be completely free from errors but it does show you what you can do with procedures. These procedures in my example could be greatly improved by using variable length fields instead of hardcoded length fields.[file name=21ff766b_TESTPROCED.TXT size=24]http://www.mcpressonline.com/images/fbfiles/files/21ff766b_TESTPROCED.TXT[/file]

    Comment


    • #3
      Are RPG Subroutines Obsolete?

      ** This thread discusses the Content article: Are RPG Subroutines Obsolete? **
      0

      Comment


      • #4
        Are RPG Subroutines Obsolete?

        THanks for the info Robert. I'm going to look over it and if any questions will post some more Thanks again.

        Comment

        Working...
        X