Created
July 19, 2020 10:08
-
-
Save RainerRoss/ad0fc639cde84d7a8c24b6e1d0b59b28 to your computer and use it in GitHub Desktop.
Code for the Array based on pointers in RPG AS400 powered by Sam John
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctl-opt dftactgrp(*no) main(main); | |
//------------------------------------------------------------------// | |
// Code for the Array based on pointers in RPG AS400 from Sam John // | |
// https://www.myeasyclasses.com/2020/07/ // | |
// code-for-array-based-on-pointers-in-rpg.html // | |
//------------------------------------------------------------------// | |
dcl-proc main; | |
dcl-s ArrayData char(10) dim(10) based(ptr1); | |
dcl-s ptr1 pointer; | |
dcl-s Arraysize packed(6); | |
dcl-s ArrayIndex packed(9); | |
ArraySize = %Size(ArrayData); | |
ptr1 = %alloc(ArraySize); | |
ArrayIndex = 1; | |
Dow ArrayIndex <= %Elem(ArrayData); | |
ArrayData(ArrayIndex) = 'A' + %Trim(%Char(ArrayIndex)); | |
Dsply ArrayData(ArrayIndex); | |
ArrayIndex = ArrayIndex + 1; | |
Enddo; | |
end-proc; | |
//------------------------------------------------------------------// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment