User:Heiko: Difference between revisions

From Try-AS/400
Jump to navigation Jump to search
No edit summary
Line 30: Line 30:
[[Image:HelloWorld01CRTSRCPF.png|666px]]
[[Image:HelloWorld01CRTSRCPF.png|666px]]


== Project 99 bottles of beer ==
--> [[Beginners Project: Hello World (using database and display file)]]
I know Rexx from my OS/2 days. Why not trying to create and run a 99 bottles of beer?
I got the source here: http://www.99-bottles-of-beer.net/language-rexx-2247.html
=== Preparations ===
Things you need:
* an AS/400 (obviously :) )
* an working account
* log in
* command prompt
* maybe this for easy reference: Basic Commands
* Create a physical file to hold the script. This is described in the [[Hello World Project]]. I created a file named <tt>BOTTLES</tt><ref><tt>'''99'''BOTTLES</tt> would have been nice, but filenames are not allowed to begin with numbers</ref>.
 
=== Create the script file ===
The next step creates a member named <tt>BOTT</tt><ref>Members cannot have the same name as the physical source file (<tt>BOTTLES</tt>). Therefore the member is named <tt>BOTT</tt>.</ref> in source file <tt>BOTTLES</tt> which is stored in library <tt>HKRETSCHME</tt>.
 
Work with the <tt>BOTTLES</tt> file:
WRKMBRPDM FILE(HKRETSCHME/BOTTLES)
or&#x2026;
WRKMBRPDM FILE(HKRETSCHME/BOTTLES) MBR(BOTT)
&#x2026;if you already created the <tt>BOTT</tt> member (=script object in <tt>BOTTLES</tt> source file)
 
[[Image:Project99BottlesWRKPDM.png|666px]]
 
Create the member <tt>BOTT</tt>:
Hit F6<ref>Alternatively start <tt>STRSEU</tt> command.</ref> to bring up the options of <tt>STRSEU</tt>:
 
[[Image:Project99BottlesSTRSEU.png|666px]]
 
Insert the code:
 
[[Image:Project99BottlesSEU.png|666px]]
 
Save the member by entering "Y" (here "J") in the first line.
 
[[Image:Project99BottlesSEUSave.png|666px]]
 
=== Run it ===
STRREXPRC SRCMBR(BOTT) SRCFILE(BOTTLES)
 
[[Image:Project99BottlesSTRREXPRC_01.png|666px]]
 
[[Image:Project99BottlesSTRREXPRC_02.png|666px]]
 
   
   
----
----

Revision as of 13:22, 30 September 2019

About

This is Heikos personal page, in which he maybe shares some private information or collects bits for new articles.

Personal information

Heiko has been in IT since the 90s, but never worked with an AS/400...until 2019. He'll document his first steps in the hope they will be useful to others.

Ideas for new articles

Project Hello World

Preparations

Things you need:

  • an AS/400 (obviously :) )
  • an working account
  • log in
  • command prompt
  • maybe this for easy reference: Basic Commands

Creating a physical file to hold the sources

Every user has a personal library, like an home in an Linux environment. Since a user can have and use multiple libraries, the current (=default for all operations) is stored in *CURLIB[1]. Because the value of *CURLIB can be changed by the screen you are currently working in, all following commands will contain my personal library name HKRETSCHME. It could be omitted if you're sure, *CURLIB is set correctly.

This command creates a physical file named HELLO01:

CRTSRCPF FILE(HKRETSCHME/HELLO01) RCDLEN(112) TEXT('Project Hello World')

But I prefer to do this in more steps, which I'd recommend to every beginner (by the way: don't bother using cases, the AS/400 won't either. Using capital commands and names just makes it more readable in this article):

CRTSRCPF

If you don't give any parameters, you will be asked. This a very convenient way use all the available options without looking them up:

HelloWorld01CRTSRCPF.png

--> Beginners Project: Hello World (using database and display file)