ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Hello World Tutorial

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

  • #16
    Re: Hello World Tutorial

    Jamief of planet Texas (oh, that's Plano) :

    The files you have in that original post is a whole bunch more than what I want to (or maybe even can) bite off at this time. I'm scared. I will figure my way through it if you think that's best, but quite honestly, I'm looking for an RPG program that makes a variable, put's "hello world" in it and then displays it in the display file. I think that's a better place for me to start.

    I tried typing out the display file because I cannot seem to be able to cut and paste into WRK***PDM - but I just thought of a way I could cut and paste it another way. So I guess I could try to put it all in and pick it apart - but there's a lot there... for me....
    I'm always worried at the end of the day that I may accidentally type in singoff.

    Comment


    • #17
      Re: Hello World Tutorial

      I can throw something together this week..
      I'd rather not start with CL, but I can if that is what you'd like.

      would you like RPG or CL?

      It would be a happy change from PHP which is consuming my every waking hour!

      jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #18
        Re: Hello World Tutorial

        RPG Please

        Let me know if you have any PHP questions; I'm well versed in PHP...

        I actually made a CL program already back on the 5th where the CL just called the display file that had Hello World hard coded into it. But that was on the development partition and my pretty little program was erased and gone forever... So square one! Yay!

        Thank you for your help!
        I'm always worried at the end of the day that I may accidentally type in singoff.

        Comment


        • #19
          Re: Hello World Tutorial

          Hi FreddyThunder:

          On a command line key in:
          dspdtaara QSS1MRI

          That will display the version/release level your system is at.
          rpg Free was available at v5r1....I would be suprised if you are at a prior level

          Best of Luck
          GLS
          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

          Comment


          • #20
            Re: Hello World Tutorial

            Originally posted by Freddythunder View Post
            @Barbara I tried your tutorial, but I do not think the servers here allow for free-format. I tried a few different things (including exactly how you stated) and I get errors when I try to compile. First problem is the '/'
            Free-format was added to the RPG IV language in 2001. If your servers don't yet support it, you might want to update them... they're at least 11 years out of date. But, I find that rather hard to believe -- more likely they have a "shop standard" that forbids free format?

            Comment


            • #21
              Re: Hello World Tutorial

              Originally posted by Scott Klement View Post
              But, I find that rather hard to believe -- more likely they have a "shop standard" that forbids free format?
              I actually shivered at the thought... Life without free. Horrible. Just. Horrible.

              Comment


              • #22
                Re: Hello World Tutorial

                There is no data area of that name in any library, but I googled a different way and used DSPSFWRCS and see that everything reads V7R1M0. I'm not sure why that RPG tutorial didn't work... until...

                I just asked one of the RPG people here about free form and he said that they do use it here. He told me where to find some in his library so I looked at that... The error I was getting is that on the tutorial, she states to have the /free starting at column 7, but that's what caused an error. Looking at my coworkers code, /free was in column 2 - that worked. So I will continue with the Hello World tutorial that Barbara linked to.

                Jamie, if you still want to make me something that would be great - if you want to hold off and let me punch through this other one, that's fine too. I'll let you all know what happens.

                Thanks again,
                I'm always worried at the end of the day that I may accidentally type in singoff.

                Comment


                • #23
                  Re: Hello World Tutorial

                  Originally posted by Freddythunder View Post
                  The error I was getting is that on the tutorial, she states to have the /free starting at column 7, but that's what caused an error. Looking at my coworkers code, /free was in column 2 - that worked.
                  Keep in mind, that the green screen editor sits off kilter a bit; the first 5 columns aren't shown on screen unless you 'CF19' over to see them. That got me when I first started as well.

                  Comment


                  • #24
                    Re: Hello World Tutorial

                    Well that's just not fair.
                    I'm always worried at the end of the day that I may accidentally type in singoff.

                    Comment


                    • #25
                      Re: Hello World Tutorial

                      You must be using SEU. In the top line of the display, it should tell you which columns are currently being shown.

                      Columns 1-5 are "normally" kept blank in RPG, so, in the interests of letting you see more code at once, the default behavior is to show you columns 6+.

                      Comment


                      • #26
                        Re: Hello World Tutorial

                        Yes, this is hilarious! I'm IMing my coworking about how when I tried the tutorial before, I remember saying to myself "hmm, number's at the top are all off; that's weird"..

                        Totally my fault. I did not RTFM correctly. It clearly states on page 1 of the tutorial "...the editor will not show you columns 1-5 by default,..."

                        Now that you say SEU, I look in the top left corner and it reads "SEU==>" so that'd probably be helpful to know...

                        Well, thank you all, I've learned more in the past 15 minutes than the whole <strike>thing</strike> MONTH in total (also learned I skim over important things). I certainly wouldn't assume that there would be hidden columns in a language where position makes a difference. I'll proudly blame the Mayans
                        I'm always worried at the end of the day that I may accidentally type in singoff.

                        Comment


                        • #27
                          Re: Hello World Tutorial

                          no programmer up to date on his/her skills has cared about spacing for many many years..

                          Might as well keep this thread going:

                          here is the display
                          PHP Code:
                               A*%%TS  SD  20121126  202444  FLANARY     REL-V7R1M0  5770-WDS                                 
                               A
                          *%%EC                                                                                         
                               A                                      DSPSIZ
                          (24 80 *DS3)                                      
                               
                          A                                      PRINT                                                   
                               
                          A                                      INDARA                                                  
                               A                                      CF01                                                    
                               A                                      CF02                                                    
                               A                                      CF03                                                    
                               A                                      CF04                                                    
                               A                                      CF05                                                    
                               A                                      CF06                                                    
                               A                                      CF07                                                    
                               A                                      CF08                                                    
                               A                                      CF09                                                    
                               A                                      CF10                                                    
                               A                                      CF11                                                    
                               A                                      CF12                                                    
                               A                                      CF13                                                    
                               A                                      CF14                                                    
                               A                                      CF15                                                    
                               A                                      CF16                                                    
                               A                                      CF17                                                    
                               A                                      CF18                                                    
                               A                                      CF19                                                    
                               A                                      CF20                                                    
                               A                                      CF21                                                    
                               A                                      CF22                                                    
                               A                                      CF23                                                    
                               A                                      CF24                                                    
                               A                                      PAGEDOWN                                                
                               A                                      PAGEUP                                                  
                               A
                          *****************************************************************                             
                               
                          A          R SCREEN1                                                                           
                               A
                          *%%TS  SD  20121126  202444  FLANARY     REL-V7R1M0  5770-WDS                                 
                               A            C1TITLE       40   O  1 21DSPATR
                          (HI)                                              
                               
                          A                                  1  3DATE                                                    
                               A                                      EDTCDE
                          (Y)                                               
                               
                          A                                      COLOR(BLU)                                              
                               
                          A                                  2  3TIME                                                    
                               A                                      COLOR
                          (BLU)                                              
                               
                          A                                  1 71USER                                                    
                               A                                      COLOR
                          (BLU)                                              
                               
                          A                                  2 71SYSNAME                                                 
                               A                                      COLOR
                          (BLU)                                              
                               
                          A            S1FIELD       70   O  8  6COLOR(PNK)                                              
                               
                          A                                 22  3'F3=Exit'                                               
                               
                          A                                      COLOR(BLU)                                              
                               
                          A                                 22 16'F8=Increment'                                          
                               
                          A                                      COLOR(BLU)                                              
                               
                          A                                 12  6'To add the date above .. use a "*"-                    
                               A                                       followed by the word(s):  DATE    -                    
                               A                                                            time         -                    
                               A                                                                         -                    
                               A                                        TIME                          use-                    
                               A                                      r                                  -                    
                               A                                                  USER                   -                    
                               A                                             system name                 -                    
                               A                                                            SYSNAME      -                    
                               A                                                                         -                    
                               A                                                                         -                    
                               A                                                     To add a field use "-                    
                               A                                      +" sign followed by "B"/"O"/"I" ==>-                    
                               A                                       both,output,input'                                     
                               
                          A                                  5  6'Use <f8> to increment counter and -                    
                               A                                      redisplay'                                              
                               
                          A                                      COLOR(BLU)                                              
                               
                          A                                  9  5'| place question mark above line a-                    
                               A                                      nd press <ENTER> to rename/change f-                    
                               A                                      ield'                                                   
                               
                          A                                      COLOR(WHT)                                              
                               
                          A                                  8  2'==>'                                                   
                               
                          A                                      COLOR(WHT)                                              
                               
                          A                                  7  5'|'                                                     
                               
                          A                                      COLOR(WHT)                                              
                               
                          A                                 10  5'| "*" in same spot to access "othe-                    
                               A                                      r" field values'                                        
                               
                          A                                      DSPATR(HI)                                              
                               
                          A                                 18  6'then the length ==> "+B(5)" will c-                    
                               A                                      reate a Both input/output field len-                    
                               A                                      gth 5'                                                  
                               
                          A                                 19  6' for numeric fields it''s +3/6/or9' 
                          Here is the RPG
                          PHP Code:
                               fDisplay   cf   e             workstn INFDS(INFDS)                                             
                                                                                                                              
                                
                          //                                                                                            
                                // Variable Definition                                                                        
                                //                                                                                            
                               
                          d endscreen1      s               n   inz('1')                                                 
                               
                          d mycounter       s              5  0 inz(1)                                                   
                               
                          d mystring        s             20    inz('Hello World')                                       
                                                                                                                              
                               
                          d Infds           ds                                                       INFDS data structure
                               d Choice                369    369                                                             
                               d Currec                378    379I 0                                                          
                                                                                                                              
                                
                          //                                                                                            
                                // Command Keys                                                                               
                                //                                                                                            
                               
                          d Cmd01           c                   const(x'31')                         Cmd-1               
                               d Cmd02           c                   
                          const(x'32')                         Cmd-2               
                               d LeaveProgram    c                   
                          const(x'33')                         Cmd-3               
                               d Cmd04           c                   
                          const(x'34')                         Cmd-4               
                               d Cmd05           c                   
                          const(x'35')                         Cmd-5               
                               d Cmd06           c                   
                          const(x'36')                         Cmd-6               
                               d Cmd07           c                   
                          const(x'37')                         Cmd-7               
                               d Increment       c                   
                          const(x'38')                         Cmd-8               
                               d Cmd09           c                   
                          const(x'39')                         Cmd-9               
                               d Cmd10           c                   
                          const(x'3A')                         Cmd-10              
                               d Cmd11           c                   
                          const(x'3B')                         Cmd-11              
                               d Cmd12           c                   
                          const(x'3C')                         Cmd-12              
                               d Cmd13           c                   
                          const(x'B1')                         Cmd-13              
                               d Cmd14           c                   
                          const(x'B2')                         Cmd-14              
                               d Cmd15           c                   
                          const(x'B3')                         Cmd-15              
                               d Cmd16           c                   
                          const(x'B4')                         Cmd-16              
                               d Cmd17           c                   
                          const(x'B5')                         Cmd-17              
                               d Cmd18           c                   
                          const(x'B6')                         Cmd-18              
                               d Cmd19           c                   
                          const(x'B7')                         Cmd-19              
                               d Cmd20           c                   
                          const(x'B8')                         Cmd-20              
                               d Cmd21           c                   
                          const(x'B9')                         Cmd-21              
                               d Cmd22           c                   
                          const(x'BA')                         Cmd-22              
                               d Cmd23           c                   
                          const(x'BB')                         Cmd-23              
                               d Cmd24           c                   
                          const(x'BC')                         Cmd-24              
                               d EnterKey        c                   
                          const(x'F1')                                             
                               
                          d RollUp          c                   const(x'F5')                         Roll Up             
                               d RollDown        c                   
                          const(x'F4')                         Roll Down           
                                                                                                                              
                                
                          /free                                                                                         
                                                                                                                              
                                        s1field 
                          mystring ' - ' + %char(mycounter);                                        
                                                                                                                              
                                        
                          dow endscreen1;   // endscreen 1 initialized to *on above                             
                                                                                                                              
                                         
                          exfmt SCREEN1;                                                                       
                                                                                                                              
                                         
                          select;                                                                              
                                        
                          //                                                                                    
                                        // F3 pressed end the program F3 = LeaveProgram                                       
                                        //                                                                                    
                                          
                          when  Choice LeaveProgram;                                                        
                                           
                          EndScreen1 = *off;                                                                 
                                        
                          //                                                                                    
                                        // F8 pressed add to counter                                                          
                                        //                                                                                    
                                          
                          when  Choice increment;                                                           
                                           
                          exsr $increment;                                                                   
                                        
                          //                                                                                    
                                        // Enter Key pressed                                                                  
                                        //                                                                                    
                                          
                          when  Choice enterKey;                                                            
                                                                                                                              
                                         
                          endsl;                                                                               
                                                                                                                              
                                        
                          enddo;                                                                                
                                                                                                                              
                                                                                                                              
                                         *
                          inlr = *on;                                                                         
                                                                                                                              
                                                                                                                              
                                  
                          //------------------------------------------------                                          
                                  // $Increment - increment counter                                                           
                                  //------------------------------------------------                                          
                                       
                          begsr $Increment;                                                                      
                                                                                                                              
                                         
                          Mycounter+=1;     // case doesnt matter                                              
                                         
                          s1field mystring ' - ' + %char(mycounter);                                       
                                                                                                                              
                                       
                          endsr;                                                                                 
                                                                                                                              
                                /
                          end-free 
                          looks like this:
                          Click image for larger version

Name:	Noname.jpg
Views:	1
Size:	49.3 KB
ID:	126594
                          Attached Files
                          All my answers were extracted from the "Big Dummy's Guide to the As400"
                          and I take no responsibility for any of them.

                          www.code400.com

                          Comment


                          • #28
                            Re: Hello World Tutorial

                            Originally posted by jamief View Post
                            no programmer up to date on his/her skills has cared about spacing for many many years..
                            Except for those of us that are forced back into code that was written before the dawn of the ice-age *cough*me*cough*... RPGII/III anyone? Most programmers I know have transitioned away from using SEU quite a while ago and gone to the Rational editor. I use it on occasion, but I like the way SEU looks (and old habits die hard).

                            Comment


                            • #29
                              Re: Hello World Tutorial

                              I guess I should have phrased that differently :
                              "only goons use Cl" ... is that better? ---
                              I still don't think you care about spacing. I remember I would guess position, hit <enter> and wait to see what highlighted..
                              and if all else fails <F4> your way out!

                              GO Navy! that's coming from a bubble head to a squid!
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment


                              • #30
                                Re: Hello World Tutorial

                                Originally posted by jamief View Post
                                no programmer up to date on his/her skills has cared about spacing for many many years..
                                ...except on F-specs, D-specs, P-specs, DDS, making sure your stuff starts in column 6+, etc...

                                Pretty much everyone cares about spacing... and it's really not a big deal.

                                Comment

                                Working...
                                X