¿ªÔÆÌåÓý

#VMCE #rexx EE goes XEDIT - compiling a wish list #VMCE #rexx


 

VM/370 does not have EXEC2.

I don't know if EE is reentrant, which is a requirement of a saved segment.?

Currently, EE resides in the user area at x'20000'.? That restricts the CMS commands it can issue to those that run?
the transient area
2. in high memory in a segment
3. in a Nucleus Extension or
4. in an area loaded by the RESLIB command.

Bob Bolch


On Thu, Oct 27, 2022, 8:00 PM Mark A. Stevens via <marXtevens=[email protected]> wrote:
On Thu, Oct 27, 2022 at 01:36 PM, Martin Scheffler wrote:
CMS HELP was based on XEDIT since VM/SP 1.
FILELIST arrived with VM/SP 2, EXEC 2 was used ( still EXEC 2 on LCM+L's VM/SP 5 but (compiled) REXX on z/VM 6.4).

REXX arrived with VM/SP 3, XEDIT received EXTRACT, Prefix Macro Support, Selective Line Editing (see ).

I think as a minimum we should approach VM/SP 3 XEDIT compatibility.

Martin
I think SP3 compatibility would be a good start. BREXX still has a problem with parsing its command line, so that will be a challenge, in and of itself. Would support of EXEC2 be present, until BREXX is fixed?

I don't know where XEDIT lives in memory, when invoked. Does putting it, or part of it in a DisContiguous Saved Segment (DCSS) hurt or help? Was it in the CMS DCSS since SP 1?

?... Mark S.


 

On Thu, Oct 27, 2022 at 07:26 PM, Bob Bolch wrote:
VM/370 does not have EXEC2.
Some day, I will remember that.

?... Mark S.


 

Hey Mark,

what do you mean by:

??BREXX still has a problem with parsing its command line, so that will be a challenge, in and of itself.¡°

The error in the parse statement or any other issue?

Mike

Mark A. Stevens via <marXtevens=[email protected]> schrieb am Do. 27. Okt. 2022 um 20:00:

On Thu, Oct 27, 2022 at 01:36 PM, Martin Scheffler wrote:
CMS HELP was based on XEDIT since VM/SP 1.
FILELIST arrived with VM/SP 2, EXEC 2 was used ( still EXEC 2 on LCM+L's VM/SP 5 but (compiled) REXX on z/VM 6.4).

REXX arrived with VM/SP 3, XEDIT received EXTRACT, Prefix Macro Support, Selective Line Editing (see ).

I think as a minimum we should approach VM/SP 3 XEDIT compatibility.

Martin
I think SP3 compatibility would be a good start. BREXX still has a problem with parsing its command line, so that will be a challenge, in and of itself. Would support of EXEC2 be present, until BREXX is fixed?

I don't know where XEDIT lives in memory, when invoked. Does putting it, or part of it in a DisContiguous Saved Segment (DCSS) hurt or help? Was it in the CMS DCSS since SP 1?

?... Mark S.

--
Von Gmail Mobile gesendet


 

On Fri, Oct 28, 2022 at 07:19 PM, Mike Gro?mann wrote:
what do you mean by:
?
??BREXX still has a problem with parsing its command line, so that will be a challenge, in and of itself.¡°
?
The error in the parse statement or any other issue?
BREXX in MVS 3.8j , and in VM/370 does not handle literals when you use PARSE ARG, or ARG. The problem was discussed in earlier e-mails:

Rexx PARSE on VM/SP 5 behaves different from BRexx on VM/370 CE V1M1R1.1.
/g/h390-vm/message/3843

Possible bug in BREXX parse instruction
/g/h390-vm/message/3736

and issues have been opened in the following GitHub projects.

PARSE errors when literal patterns used #8


BREXX PARSE errors with literals in the template #61


I Hope This Helps
?... Mark S.


 

The bREXX bug with literals in the parse template does not break running editor macros in general. If anybody knows of a XEDIT macro where this bug would change behaviour, I'd like to see it. I am sure there is always a way to program around this bug and I am confident to say this because of my experience on VM/SP 1+2.

Martin


 

On Fri, Oct 28, 2022 at 02:00 AM, Mark A. Stevens wrote:
I don't know where XEDIT lives in memory, when invoked. Does putting it, or part of it in a DisContiguous Saved Segment (DCSS) hurt or help? Was it in the CMS DCSS since SP 1?
Quote from page 348:
System Product Editor Interface to Access Files in Storage

CMS uses the SUBCOM facility to allow a number of CMS commands to use an
XEDIT interface to access files in storage. Applications can read or write specific
records without having to go to disk or use the program stack to transfer the data
to or from XEDIT. This improves performance.
This interface is used internally by CMS for processing the FILELIST, HELP,
PEEK, and SENDFILE commands. The interface is invoked by specifying the
XEDIT option on the LISTFILE or NAMEFIND commands. This option may
only be specified from the XEDIT environment.
When using this interface from an application program, only the extended Parame-
ter List can be used, and the high-order byte of of Register 1 must contain X'02' to
indicate SUBCOM is being used.
The application can invoke this interface via SVC 202 or via a BALR instruction.
Because XEDIT is a nucleus-resident routine, other nucleus-resident routines can
branch directly to it while routines that do not resides in the nucleus use SVC link-
age. When using an SVC 202, register 1 must point to the FSCB where the name
of the routine being invoked is the first token. [...]

348 VM/SP System Programmer's Guide


 

On Thu, Oct 27, 2022 at 05:45 PM, Martin Scheffler wrote:
What do I need for "EE goes XEDIT" ?
  • from C call an assembler routine to establish a CMS SUBCOM evironment "XEDIT"
  • an assembler routine which receives subcommand calls and calls the C part of the editor
  • an assembler routine using EXECCOMM to share REXX variables, EXTRACT needs this
Some progress ... EE is seeing subcommands via bREXX and sets return code 4711?? () :

File: CLOSE??? EXEC???? A1???????????? ?
?====> cms close?????????????????????? ?
?File written: CLOSE EXEC A1?????????? ?
??? 0 * * * Top of File * * *????????? ?
??? 1 /* REXX */?????????????????????? ?
??? 2 trace i????????????????????????? ?
??? 3 address "CMS" "IDENTIFY"???????? ?
??? 4 say rc?????????????????????????? ?
??? 5 address "JUNK" "IDENTIFY"??????? ?
??? 6 say rc?????????????????????????? ?
??? 7 address "XEDIT" "IDENTIFY"?????? ?
??? 8 say rc?????????????????????????? ?
??? 9 say "Hit ENTER to continue ..."? ?
?? 10 parse pull?????????????????????? ?
?? 12 exit rc????????????????????????? ?
?? 12 * * * End of File * * *????????? ?
?????????????????????????????????????? ?

???? 3 *-* address "CMS" "IDENTIFY"???????????????????????????????? ?
?????? >>>?? "CMS"????????????????????????????????????????????????? ?
?????? >L>?? "IDENTIFY"???????????????????????????????????????????? ?
MECAFF?? AT VM370CE? VIA RSCS???? 07:42:45 10/30/22 GMT???? SUNDAY? ?
???? 4 *-* say rc?????????????????????????????????????????????????? ?
?????? >V>?? "0"??????????????????????????????????????????????????? ?
0?????????????????????????????????????????????????????????????????? ?
???? 5 *-* address "JUNK" "IDENTIFY"??????????????????????????????? ?
?????? >>>?? "JUNK"???????????????????????????????????????????????? ?
?????? >L>?? "IDENTIFY"???????????????????????????????????????????? ?
???? 6 *-* say rc?????????????????????????????????????????????????? ?
?????? >V>?? "-3"?????????????????????????????????????????????????? ?
-3????????????????????????????????????????????????????????????????? ?
???? 7 *-* address "XEDIT" "IDENTIFY"?????????????????????????????? ?
?????? >>>?? "XEDIT"??????????????????????????????????????????????? ?
?????? >L>?? "IDENTIFY"???????????????????????????????????????????? ?
???? 8 *-* say rc?????????????????????????????????????????????????? ?
?????? >V>?? "4711"???????????????????????????????????????????????? ?
4711??????????????????????????????????????????????????????????????? ?
???? 9 *-* say "Hit ENTER to continue ..."????????????????????????? ?
?????? >L>?? "Hit ENTER to continue ..."??????????????????????????? ?
Hit ENTER to continue ...?????????????????????????????????????????? ?
??? 10 *-* parse pull?????????????????????????????????????????????? ?
?????????????????????????????????????????????????????????????????????






  • ?


 

Hello,

Please add to the wishlist:? Accept * for the drive letter (e.g. EE DMKSYS ASSEMBLE *).

It would also be nice to have a SYNONYM list for filetypes (e.g. ASM for ASSEMBLE).

Thank you for asking for wish list items.

Bertram / WB8ERT


 

On Sun, Oct 30, 2022 at 12:33 PM, Bertram Moshier wrote:
Please add to the wishlist:? Accept * for the drive letter (e.g. EE DMKSYS ASSEMBLE *).
This should be acceptable, XEDIT on z/VM 6.4 behaves this way. LCM+L's VM/SP 5 is down atm.
It would also be nice to have a SYNONYM list for filetypes (e.g. ASM for ASSEMBLE).
This might be a typical task for the profile when EE will be able to run REXX-powered macros.
Here an example for XEDIT on z/VM 6.4 :

?PROFILE? XEDIT??? A1? V 255? Trunc=255 Size=17 Line=0 Col=1 Alt=0??? ?
====>???????????????????????????????????????????????????????????????? ?
????? |...+....1....+....2....+....3....+....4....+....5....+....6....+
????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *???????????????????????????????????????? ?
??? 1 /* REXX */????????????????????????????????????????????????????? ?
??? 2 parse arg fn ft next??????????????????????????????????????????? ?
??? 3???????????????????????????????????????????????????????????????? ?
??? 4 fn = strip(fn)????????????????????????????????????????????????? ?
??? 5 upper fn??????????????????????????????????????????????????????? ?
??? 6 if abbrev("ASSEMBLE",ft,1) then "LOAD" fn "ASSEMBLE"??????????? ?
??? 7 if abbrev("ASM"???? ,ft,3) then "LOAD" fn "ASSEMBLE"??????????? ?
??? 8 if abbrev("XEDIT"?? ,ft,1) then "LOAD" fn "XEDIT"?????????????? ?
??? 9???????????????????????????????????????????????????????????????? ?
?? 10 /* all other commands AFTER "LOAD" */?????????????????????????? ?
?? 11 "set case m i"????????????????????????????????????????????????? ?
?? 12 "set prefix nulls left"???????????????????????????????????????? ?
?? 13 "set number on"???????????????????????????????????????????????? ?
?? 14 "set cmdline top"?????????????????????????????????????????????? ?
?? 15 "set scale on 3"??????????????????????????????????????????????? ?
?? 16 "set msgline on 3 20 overlay"?????????????????????????????????? ?
?? 17 "set curline on 5"????????????????????????????????????????????? ?
?? 18 * * * End of File * * *???????????????????????????????????????? ?
??????????????????????????????????????????????????????????????????????



 

My POFILE XEDIT has for ages some filetype synonyms, like A for ASSEMBLE, E for EXEC etc.
But, that initial setup was not perfect: if you happen to have a file named "TEST A A" you are unable to XEDIT it (unless with option NOPROF)
So what I did after a while was something rougly like this
? parse arg fn ft fm '('? options
? address command 'STATE' fn ft fm? /* if file exists: don't use ftype synonyms */
? if rc<>0 then ft=changeShortFtypes(ft)
? 'LOAD' fn ft fm '(' options
??
--
Kris Buelens


 

On Thu, Oct 27, 2022 at 05:45 PM, Martin Scheffler wrote:
What do I need for "EE goes XEDIT" ?
  • from C call an assembler routine to establish a CMS SUBCOM evironment "XEDIT"
  • an assembler routine which receives subcommand calls and calls the C part of the editor
  • an assembler routine using EXECCOMM to share REXX variables, EXTRACT needs this
I am stuck at the second step since several days. I have written a special debugging tool outside of EE and found problems with the C standard library. There might be an incompatibilty of calling conventions.

Quote from ?? p. 347:
When a program issues an SVC 202 call to a program that has become known to
CMS via SUBCOM, it places X'02' in the high-order byte of register one. Control
passes to the called program at the address specified by the called program when it
invoked SUBCOM.

The PSW specifies the system mask, the PSW key to be used, the program mask
(and initial condition code), and the starting address for execution. The
problem-state bit and machine-check bit may be set. The machine-check bit has
no effect in CMS under CP. The EC-mode bit and wait-state bit cannot be set;
they are always forced to zero. Also, one 4-byte user-defined word can be associ-
ated with the SUBCOM entry point, and referred to when the entry point is subse-
quently called.

Note: When control passes to the specified entry point, the register contents are:

R? 2? Address of SCBLOCK for this entry point.
R 12? Entry point address.
R 13? 24-word save area address.
R 14? Return address (CMSRET).
R 15? Entry point address.?
The SUBCOM entry point has to be implemented in assembler because direct access to registers is needed (R0, R2 are the most important to do real work). When calling C functions from here, there are loops and crashes if using stdio functions like sprintf(). I have written some demo code where I have avoided using stdio. For further debugging I have to build (parts of) the library myself.

The demo ouput below shows the recording of subcommands issued to the XTEST environment by a REXX program. No actual execution of subcommands is implemented here.

EE$XTEST?????????????????????????????????????????????????????????????????????????????
00:47? ---? SUBCOM XTEST : RC from SVC202, flag 1 = 0???????????????????????????????? ?
CMS bREXX 1.0.1 Jul? 5 2022?????????????????????????????????????????????????????????? ?
CMS COMMAND demo demo???????????????????????????????????????????????????????????????? ?
say 'Hello World :- ) '?????????????????????????????????????????????????????????????? ?
address() =? CMS????????????????????????????????????????????????????????????????????? ?
?? ---? MACRO DEMO XTEST : RC from SVC202???????????????????????????????????????????? ?
Macro executed -> RC = 196??????????????????????????????????????????????????????????? ?
Starting macro : counter = 0 ????????????????????????????????????????????? ?
A? set case m i?????????????????????????????????????????????????????????????????????? ?
B? locate /mystring?????????????????????????????????????????????????????????????????? ?
C? extract /curline/????????????????????????????????????????????????????????????????? ?
D? input ' ) -: dlroW olleH' yas????????????????????????????????????????????????????? ?
E? input 1 2 1 1????????????????????????????????????????????????????????????????????? ?
F? input 2 4 4 4????????????????????????????????????????????????????????????????????? ?
G? input 3 6 9 27???????????????????????????????????????????????????????????????????? ?
H? input 4 8 16 256?????????????????????????????????????????????????????????????????? ?
I? input 5 10 25 3125???????????????????????????????????????????????????????????????? ?
J? input 6 12 36 46656??????????????????????????????????????????????????????????????? ?
K? input 7 14 49 823543?????????????????????????????????????????????????????????????? ?
L? input 8 16 64 16777216???????????????????????????????????????????????????????????? ?
M? input 9 18 81 387420489??????????????????????????????????????????????????????????? ?
N? input 10 20 100 1E+10????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
Memory dump at 000207e0:????????????????????????????????????????????????????????????? ?
000207e0 :? e7 e3 c5 e2? e3 40 40 40? 00 00 00 00? 00 00 00 00??? XTES T??? .... .... ?
000207f0 :? 00 e7 44 08? 00 e7 a6 78? 00 e7 a6 8d? 00 00 00 00??? .X¨¤. .Xw? .Xw? .... ?
00020800 :? 89 95 97 a4? a3 40 f1 f0? 40 f2 f0 40? f1 f0 f0 40??? inpu t 10? 20? 100? ?
00020810 :? f1 c5 4e f1? f0 00 f9 00? 00 00 00 00? 00 00 00 00??? 1E+1 0.9. .... .... ?
00020820 :? 00 00 00 00? 00 00 00 00? 00 00 00 00? 60 02 28 72??? .... .... .... -..? ?
00020830 :? 00 00 00 c4? 00 e7 44 18? 02 e7 44 08? 00 00 90 90??? ...D .X¨¤. .X¨¤. ..¡ã¡ã ?
00020840 :? 00 02 07 e0? 00 01 fc b0? 00 00 00 00? 00 e7 a6 78??? ...\ ..?? .... .Xw? ?
00020850 :? 00 00 32 60? 00 00 90 90? 00 01 fc b0? 00 f8 27 74??? ...- ..¡ã¡ã ..?? .8.? ?
00020860 :? 00 01 fc b0? 00 02 27 e0? 00 00 00 00? 00 00 00 00??? ..?? ...\ .... .... ?
00020870 :? 00 00 00 00? 00 00 00 00? 00 00 00 00? 00 00 00 00??? .... .... .... .... ?
00020880 :? 00 00 00 00? 00 00 00 00? 00 00 00 00? 00 00 00 00??? .... .... .... .... ?
00020890 :? 00 00 00 00? 00 00 00 00? 00 00 00 00? 00 00 00 00??? .... .... .... .... ?
????????????????????????????????????????????????????????????????????????????????????? ?
sc_buff[4096] at X'000207e0': XTEST?????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
Hit ENTER to continue ...???????????????????????????????????????????????????????????? ?
quit????????????????????????????????????????????????????????????????????????????????? ?
00:47? ---? SUBCOM XTEST : RC from SVC202, flag 0 = 0???????????????????????????????? ?
counter = 14????????????????????????????????????????????????????????????????????????? ?
Ready(00196); T=0.04/0.09 00:01:12??????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
File: DEMO???? EXEC???? A1??????????????????????????????????????????????????????????? ?
====>???????????????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *???????????????????????????????????????????????????????? ?
??? 1 /* REXX */????????????????????????????????????????????????????????????????????? ?
??? 2 trace n???????????????????????????????????????????????????????????????????????? ?
??? 3 parse version v???????????????????????????????????????????????????????????????? ?
??? 4 say v?????????????????????????????????????????????????????????????????????????? ?
??? 5 parse source s????????????????????????????????????????????????????????????????? ?
??? 6 say s?????????????????????????????????????????????????????????????????????????? ?
??? 7 parse arg a???????????????????????????????????????????????????????????????????? ?
??? 8 say a?????????????????????????????????????????????????????????????????????????? ?
??? 9 say "address() = " address()??????????????????????????????????????????????????? ?
?? 10???????????????????????????????????????????????????????????????????????????????? ?
?? 11 address "XTEST"???????????????????????????????????????????????????????????????? ?
?? 12 "set case m i"????????????????????????????????????????????????????????????????? ?
?? 13 "locate /mystring"????????????????????????????????????????????????????????????? ?
?? 14 "extract /curline/"???????????????????????????????????????????????????????????? ?
?? 15 "input" reverse(a)????????????????????????????????????????????????????????????? ?
?? 16???????????????????????????????????????????????????????????????????????????????? ?
?? 17 do i = 1 to 10????????????????????????????????????????????????????????????????? ?
?? 18?? "input" i i+i i*i i**i??????????????????????????????????????????????????????? ?
?? 19 end???????????????????????????????????????????????????????????????????????????? ?
?? 20 exit rc???????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????????? ?






withtct 27, 2022 at 05:


 

On Mon, Nov 7, 2022 at 02:15 AM, Martin Scheffler wrote:
There might be an incompatibilty of calling conventions.
It is R13. AFAIK CMS does not know anything about GCCCRAB, therefore the SUBCOM entry handler does not know what R13 should point to.? @DSTAKIN expects specific things through R13, see file? DYNSTK ASSEMBLE H1???? on?? GCCCMS??? .

File: DYNSTK?? ASSEMBLE H1?????????????????????????????????????????????? ?
===>???????????????????????????????????????????????????????????????????? ?
?? 11 * ?
?? 12 *??????????????????????????????????????????????????????????????? * ?
?? 13 * Assembler stubs for the dynamic stack implemetation??????????? * ?
?? 14 * These routines are called from PDPEPIL and PDPPRLG MACROs????? * ?
?? 15 * To maximise performance, as they have not got a save area they * ?
?? 16 * can use to save registers, and because Adrian's lack of??????? * ?
?? 17 * experience these use a register based linkage:???????????????? * ?
?? 18 *?? R5 for the base (called address)???????????????????????????? * ?
?? 19 *?? R15 is used by callers - should not be touched?????????????? * ?
?? 20 *?? R14 Return Address?????????????????????????????????????????? * ?
?? 21 *?? R13 Save Area / stack frame being manipulated??????????????? * ?
?? 22 *?? R12 is the callers base address - should not be touched????? * ?
?? 23 *??????????????????????????????????????????????????????????????? * ?
?? 24 * ?
?? 25 *??????????????????????????????????????????????????????????????? * ?
?? 26 DYNSTK?? CSECT???????????????????????????????????????????????????? ?
?? 27 *????????????????????????????????????????????????????????????????? ?
?? 28 * ?
?? 29 * @DSTAKIN - Into a new strack frame???????????????????????????? * ?
?? 30 * The point of this stub is to call MORESTAK when the current??? * ?
?? 31 * stack bin is used up?????????????????????????????????????????? * ?
?? 32 * ?
?? 33 * Parameters (see also this file's header)???????????????????????? ?
?? 34 *?? R9 - Stack Space requested???????????????????????????????????? ?
?? 35 * Register Usage:????????????????????????????????????????????????? ?
?? 36 *?? R11 - End of STACK BIN???????????????????????????????????????? ?
?? 37 *?? R8 - GCCCRAB?????????????????????????????????????????????????? ?
?? 38 *?? R7 - Next Available byte on the Stack (i.e. the new save area) ?
?? 39 *?? R6 - The end of the requested area in current bin (might be??? ?
?? 40 *??????? too big). The next free space after the new frame.??????? ?
?? 41 *?? R0 - Work Register???????????????????????????????????????????? ?
?? 42 *?? R1 - MORESTAK parameter pointer??????????????????????????????? ?
?? 43 *?? R2 - Saved R1 during MORESTAK Call???????????????????????????? ?
?? 44 *?? R3 - Saved R14 during MORESTAK call??????????????????????????? ?
?? 45 * Output?????????????????????????????????????????????????????????? ?
?? 46 *?? R13 - New Frame??????????????????????????????????????????????? ?
?? 47 * ?
?? 48????????? ENTRY @DSTAKIN??????????????????????????????????????????? ?
?? 49 @DSTAKIN DS??? 0H????????????????????????????????????????????????? ?
?? 50????????? USING @DSTAKIN,R5???????????????????????????????????????? ?
?? 51????????? USING CMSCRAB,R13???????????????????????????????????????? ?
?? 52????????? L???? R8,GCCCRABA????? get address of the GCCCRAB???????? ?
?? 53????????? USING GCCCRAB,R8????????????????????????????????????????? ?
?? 54 * Get the dynamic stack information pointer??????????????????????? ?
?? 55????????? L???? R11,DSTACK???? Get the dynamic stack control??????? ?
?? 56 *????????????????????????????? from R13 save area reserved word??? ?
?? 57????????? LA??? R11,0(,R11)??? Remove flag bits???????????????????? ?
?? 58 * Get new save area in R7????????????????????????????????????????? ?
?? 59????????? L???? R7,STACKNXT??? get next available byte in GCC stack ?
?? 60 *?????????????????????????????? from the CMSCRAB work area???????? ?
?? 61 * Get the address after the frame of the required size in R6?????? ?
?? 62????????? LA??? R6,0(R7,R9)??? point to end of R9 sized stack?????? ?
?? 63 * Have we enough space???????????????????????????????????????????? ?
?? 64????????? CR??? R6,R11???????? Request bigger than available??????? ?
?? 65????????? BNH?? OKSTACK???????????????????????????????????????????? ?
?? 66????????? CLI?? DSTACK,X'01'?? Check stack flags??????????????????? ?
?? 67????????? BL??? OKSTACK??????? If flag is zero, no check is done??? ?
?? 68 * Insufficient space in this stack segment, allocate some????????? ?
?? 69????????? BE??? OVERFLOW?????? If static, then overflow error?????? ?
?? 70 *????????????????????????????????????????????????????????????????? ?
?? 71 * Calling MORESTAK???????????????????????????????????????????????? ?
?? 72????????? LR??? R3,R14?????????? Return address to PDPPRLG????????? ?
?? 73????????? LR??? R2,R1??????????? Hold R1 (C function parms)???????? ?
?? 74 *????????????????????????????????????????????????????????????????? ?
?? 75 * MORESTAK needs a two word parameter list.??????????????????????? ?
?? 76 *????????? Word 1 is the address of the current stack frame??????? ?
?? 77 *????????? Word 2 is the frame size requested????????????????????? ?
?? 78????????? LR??? R6,R13?????????? Pointer to current stack frame???? ?
?? 79????????? LR??? R7,R9??????????? Frame size wanted????????????????? ?


 

Hi Martin,
You are correct in that CMS calling sequences, program management structure, and interface to
supervisor services know nothing about the GCC compiler runtime interface.?
Enabling EE to use BREXX macros is further complicated by the fact that there are two separate
and distinct C runtime environments in play (one in EE, and the other in BREXX).

A similar?set of issues are present and solved in my implementation of EXECCOMM for BREXX.
I do think BREXX macros for EE can be made to work, but it is going to require an in depth knowledge?
of both GCC and CMS internals to make it happen.

Bob Bolch


On Tue, Nov 8, 2022 at 4:43 AM Martin Scheffler <San-Lorenzo@...> wrote:
On Mon, Nov 7, 2022 at 02:15 AM, Martin Scheffler wrote:
There might be an incompatibilty of calling conventions.
It is R13. AFAIK CMS does not know anything about GCCCRAB, therefore the SUBCOM entry handler does not know what R13 should point to.? @DSTAKIN expects specific things through R13, see file? DYNSTK ASSEMBLE H1???? on?? GCCCMS??? .

File: DYNSTK?? ASSEMBLE H1?????????????????????????????????????????????? ?
===>???????????????????????????????????????????????????????????????????? ?
?? 11 * ?
?? 12 *??????????????????????????????????????????????????????????????? * ?
?? 13 * Assembler stubs for the dynamic stack implemetation??????????? * ?
?? 14 * These routines are called from PDPEPIL and PDPPRLG MACROs????? * ?
?? 15 * To maximise performance, as they have not got a save area they * ?
?? 16 * can use to save registers, and because Adrian's lack of??????? * ?
?? 17 * experience these use a register based linkage:???????????????? * ?
?? 18 *?? R5 for the base (called address)???????????????????????????? * ?
?? 19 *?? R15 is used by callers - should not be touched?????????????? * ?
?? 20 *?? R14 Return Address?????????????????????????????????????????? * ?
?? 21 *?? R13 Save Area / stack frame being manipulated??????????????? * ?
?? 22 *?? R12 is the callers base address - should not be touched????? * ?
?? 23 *??????????????????????????????????????????????????????????????? * ?
?? 24 * ?
?? 25 *??????????????????????????????????????????????????????????????? * ?
?? 26 DYNSTK?? CSECT???????????????????????????????????????????????????? ?
?? 27 *????????????????????????????????????????????????????????????????? ?
?? 28 * ?
?? 29 * @DSTAKIN - Into a new strack frame???????????????????????????? * ?
?? 30 * The point of this stub is to call MORESTAK when the current??? * ?
?? 31 * stack bin is used up?????????????????????????????????????????? * ?
?? 32 * ?
?? 33 * Parameters (see also this file's header)???????????????????????? ?
?? 34 *?? R9 - Stack Space requested???????????????????????????????????? ?
?? 35 * Register Usage:????????????????????????????????????????????????? ?
?? 36 *?? R11 - End of STACK BIN???????????????????????????????????????? ?
?? 37 *?? R8 - GCCCRAB?????????????????????????????????????????????????? ?
?? 38 *?? R7 - Next Available byte on the Stack (i.e. the new save area) ?
?? 39 *?? R6 - The end of the requested area in current bin (might be??? ?
?? 40 *??????? too big). The next free space after the new frame.??????? ?
?? 41 *?? R0 - Work Register???????????????????????????????????????????? ?
?? 42 *?? R1 - MORESTAK parameter pointer??????????????????????????????? ?
?? 43 *?? R2 - Saved R1 during MORESTAK Call???????????????????????????? ?
?? 44 *?? R3 - Saved R14 during MORESTAK call??????????????????????????? ?
?? 45 * Output?????????????????????????????????????????????????????????? ?
?? 46 *?? R13 - New Frame??????????????????????????????????????????????? ?
?? 47 * ?
?? 48????????? ENTRY @DSTAKIN??????????????????????????????????????????? ?
?? 49 @DSTAKIN DS??? 0H????????????????????????????????????????????????? ?
?? 50????????? USING @DSTAKIN,R5???????????????????????????????????????? ?
?? 51????????? USING CMSCRAB,R13???????????????????????????????????????? ?
?? 52????????? L???? R8,GCCCRABA????? get address of the GCCCRAB???????? ?
?? 53????????? USING GCCCRAB,R8????????????????????????????????????????? ?
?? 54 * Get the dynamic stack information pointer??????????????????????? ?
?? 55????????? L???? R11,DSTACK???? Get the dynamic stack control??????? ?
?? 56 *????????????????????????????? from R13 save area reserved word??? ?
?? 57????????? LA??? R11,0(,R11)??? Remove flag bits???????????????????? ?
?? 58 * Get new save area in R7????????????????????????????????????????? ?
?? 59????????? L???? R7,STACKNXT??? get next available byte in GCC stack ?
?? 60 *?????????????????????????????? from the CMSCRAB work area???????? ?
?? 61 * Get the address after the frame of the required size in R6?????? ?
?? 62????????? LA??? R6,0(R7,R9)??? point to end of R9 sized stack?????? ?
?? 63 * Have we enough space???????????????????????????????????????????? ?
?? 64????????? CR??? R6,R11???????? Request bigger than available??????? ?
?? 65????????? BNH?? OKSTACK???????????????????????????????????????????? ?
?? 66????????? CLI?? DSTACK,X'01'?? Check stack flags??????????????????? ?
?? 67????????? BL??? OKSTACK??????? If flag is zero, no check is done??? ?
?? 68 * Insufficient space in this stack segment, allocate some????????? ?
?? 69????????? BE??? OVERFLOW?????? If static, then overflow error?????? ?
?? 70 *????????????????????????????????????????????????????????????????? ?
?? 71 * Calling MORESTAK???????????????????????????????????????????????? ?
?? 72????????? LR??? R3,R14?????????? Return address to PDPPRLG????????? ?
?? 73????????? LR??? R2,R1??????????? Hold R1 (C function parms)???????? ?
?? 74 *????????????????????????????????????????????????????????????????? ?
?? 75 * MORESTAK needs a two word parameter list.??????????????????????? ?
?? 76 *????????? Word 1 is the address of the current stack frame??????? ?
?? 77 *????????? Word 2 is the frame size requested????????????????????? ?
?? 78????????? LR??? R6,R13?????????? Pointer to current stack frame???? ?
?? 79????????? LR??? R7,R9??????????? Frame size wanted????????????????? ?


 

¿ªÔÆÌåÓý

On Tue, 2022-11-08 at 08:39 -0500, Bob Bolch wrote:
Hi Martin,
You are correct in that CMS calling sequences, program management structure, and interface to
supervisor services know nothing about the GCC compiler runtime interface.?
Enabling EE to use BREXX macros is further complicated by the fact that there are two separate
and distinct C runtime environments in play (one in EE, and the other in BREXX).

As I am not in the weeds like some of you, can you help me understand how we ended up with two distinct C runtime environments? And how did you run into the same thing with BREXX?
Just curious.

Did we not use GCC to compile these programs?

And also a little confused.

Harold Grovesteen


A similar?set of issues are present and solved in my implementation of EXECCOMM for BREXX.
I do think BREXX macros for EE can be made to work, but it is going to require an in depth knowledge?
of both GCC and CMS internals to make it happen.

Bob Bolch


On Tue, Nov 8, 2022 at 4:43 AM Martin Scheffler <San-Lorenzo@...> wrote:
On Mon, Nov 7, 2022 at 02:15 AM, Martin Scheffler wrote:
There might be an incompatibilty of calling conventions.
It is R13. AFAIK CMS does not know anything about GCCCRAB, therefore the SUBCOM entry handler does not know what R13 should point to.? @DSTAKIN expects specific things through R13, see file? DYNSTK ASSEMBLE H1???? on?? GCCCMS??? .

File: DYNSTK?? ASSEMBLE H1?????????????????????????????????????????????? ?
===>???????????????????????????????????????????????????????????????????? ?
?? 11 * ?
?? 12 *??????????????????????????????????????????????????????????????? * ?
?? 13 * Assembler stubs for the dynamic stack implemetation??????????? * ?
?? 14 * These routines are called from PDPEPIL and PDPPRLG MACROs????? * ?
?? 15 * To maximise performance, as they have not got a save area they * ?
?? 16 * can use to save registers, and because Adrian's lack of??????? * ?
?? 17 * experience these use a register based linkage:???????????????? * ?
?? 18 *?? R5 for the base (called address)???????????????????????????? * ?
?? 19 *?? R15 is used by callers - should not be touched?????????????? * ?
?? 20 *?? R14 Return Address?????????????????????????????????????????? * ?
?? 21 *?? R13 Save Area / stack frame being manipulated??????????????? * ?
?? 22 *?? R12 is the callers base address - should not be touched????? * ?
?? 23 *??????????????????????????????????????????????????????????????? * ?
?? 24 * ?
?? 25 *??????????????????????????????????????????????????????????????? * ?
?? 26 DYNSTK?? CSECT???????????????????????????????????????????????????? ?
?? 27 *????????????????????????????????????????????????????????????????? ?
?? 28 * ?
?? 29 * @DSTAKIN - Into a new strack frame???????????????????????????? * ?
?? 30 * The point of this stub is to call MORESTAK when the current??? * ?
?? 31 * stack bin is used up?????????????????????????????????????????? * ?
?? 32 * ?
?? 33 * Parameters (see also this file's header)???????????????????????? ?
?? 34 *?? R9 - Stack Space requested???????????????????????????????????? ?
?? 35 * Register Usage:????????????????????????????????????????????????? ?
?? 36 *?? R11 - End of STACK BIN???????????????????????????????????????? ?
?? 37 *?? R8 - GCCCRAB?????????????????????????????????????????????????? ?
?? 38 *?? R7 - Next Available byte on the Stack (i.e. the new save area) ?
?? 39 *?? R6 - The end of the requested area in current bin (might be??? ?
?? 40 *??????? too big). The next free space after the new frame.??????? ?
?? 41 *?? R0 - Work Register???????????????????????????????????????????? ?
?? 42 *?? R1 - MORESTAK parameter pointer??????????????????????????????? ?
?? 43 *?? R2 - Saved R1 during MORESTAK Call???????????????????????????? ?
?? 44 *?? R3 - Saved R14 during MORESTAK call??????????????????????????? ?
?? 45 * Output?????????????????????????????????????????????????????????? ?
?? 46 *?? R13 - New Frame??????????????????????????????????????????????? ?
?? 47 * ?
?? 48????????? ENTRY @DSTAKIN??????????????????????????????????????????? ?
?? 49 @DSTAKIN DS??? 0H????????????????????????????????????????????????? ?
?? 50????????? USING @DSTAKIN,R5???????????????????????????????????????? ?
?? 51????????? USING CMSCRAB,R13???????????????????????????????????????? ?
?? 52????????? L???? R8,GCCCRABA????? get address of the GCCCRAB???????? ?
?? 53????????? USING GCCCRAB,R8????????????????????????????????????????? ?
?? 54 * Get the dynamic stack information pointer??????????????????????? ?
?? 55????????? L???? R11,DSTACK???? Get the dynamic stack control??????? ?
?? 56 *????????????????????????????? from R13 save area reserved word??? ?
?? 57????????? LA??? R11,0(,R11)??? Remove flag bits???????????????????? ?
?? 58 * Get new save area in R7????????????????????????????????????????? ?
?? 59????????? L???? R7,STACKNXT??? get next available byte in GCC stack ?
?? 60 *?????????????????????????????? from the CMSCRAB work area???????? ?
?? 61 * Get the address after the frame of the required size in R6?????? ?
?? 62????????? LA??? R6,0(R7,R9)??? point to end of R9 sized stack?????? ?
?? 63 * Have we enough space???????????????????????????????????????????? ?
?? 64????????? CR??? R6,R11???????? Request bigger than available??????? ?
?? 65????????? BNH?? OKSTACK???????????????????????????????????????????? ?
?? 66????????? CLI?? DSTACK,X'01'?? Check stack flags??????????????????? ?
?? 67????????? BL??? OKSTACK??????? If flag is zero, no check is done??? ?
?? 68 * Insufficient space in this stack segment, allocate some????????? ?
?? 69????????? BE??? OVERFLOW?????? If static, then overflow error?????? ?
?? 70 *????????????????????????????????????????????????????????????????? ?
?? 71 * Calling MORESTAK???????????????????????????????????????????????? ?
?? 72????????? LR??? R3,R14?????????? Return address to PDPPRLG????????? ?
?? 73????????? LR??? R2,R1??????????? Hold R1 (C function parms)???????? ?
?? 74 *????????????????????????????????????????????????????????????????? ?
?? 75 * MORESTAK needs a two word parameter list.??????????????????????? ?
?? 76 *????????? Word 1 is the address of the current stack frame??????? ?
?? 77 *????????? Word 2 is the frame size requested????????????????????? ?
?? 78????????? LR??? R6,R13?????????? Pointer to current stack frame???? ?
?? 79????????? LR??? R7,R9??????????? Frame size wanted????????????????? ?

._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#4667) | Reply To Group | Reply To Sender | Mute This Topic | New Topic
Mute #vmce | Mute #rexx
Your Subscription | Contact Group Owner | Unsubscribe [h.grovsteen@...]

_._,_._,_


 

On Tue, Nov 8, 2022 at 04:52 PM, Harold Grovesteen wrote:
can you help me understand how we ended up with two distinct C runtime environments?
It is the dynamic data, not the code.

  • a user "kicks" CMS to start EE, EE initializes its runtime data
  • EE calls CMS for macro execution
  • CMS sees "/*" and starts bREXX, bREXX initializes its very own runtime data
  • the macro wants to execute an EE subcommand, EE had setup itself as subcommand handler before
  • CMS calls EE's subcommand handler, but has no knowledge about EE's already existing runtime data

IBM had to solve this problem when they made XEDIT, EXEC 2 did the job on VM/SP 1+2


 

Martin is exactly right. What I call "the C runtime environment" is the CMSCRAB control block which?
is basically the R13 save area for the currently running C function, and other pointers for stack control
followed by automatic?variables for the running function. One GCC program can call another, of course,
but there are no read/write areas common to multiple C programs. EE can call BREXX, but only using
CMSCALL (SVC 202 in VM/370). BREXX can't run a subroutine that is part of EE (without some tricks :-).
Bob

On Tue, Nov 8, 2022 at 11:19 AM Martin Scheffler <San-Lorenzo@...> wrote:
On Tue, Nov 8, 2022 at 04:52 PM, Harold Grovesteen wrote:
can you help me understand how we ended up with two distinct C runtime environments?
It is the dynamic data, not the code.

  • a user "kicks" CMS to start EE, EE initializes its runtime data
  • EE calls CMS for macro execution
  • CMS sees "/*" and starts bREXX, bREXX initializes its very own runtime data
  • the macro wants to execute an EE subcommand, EE had setup itself as subcommand handler before
  • CMS calls EE's subcommand handler, but has no knowledge about EE's already existing runtime data

IBM had to solve this problem when they made XEDIT, EXEC 2 did the job on VM/SP 1+2


 

¿ªÔÆÌåÓý

OK. I get it. ?It isn't different C libraries. ?In modern terms there are two separate ABI (application binary interface) stacks that do not communicate between each other.

Or, perhaps a better description is a way for either program to know how to call the other or how to share data with each other.

Yes, a bit "yucky" to deal with to say the least. ?Some assembler somewhere will likely do the "trick".

Thanks, for the explanation,
Harold Grovesteen

On Tue, 2022-11-08 at 14:04 -0500, Bob Bolch wrote:
Martin is exactly right. What I call "the C runtime environment" is the CMSCRAB control block which?
is basically the R13 save area for the currently running C function, and other pointers for stack control
followed by automatic?variables for the running function. One GCC program can call another, of course,
but there are no read/write areas common to multiple C programs. EE can call BREXX, but only using
CMSCALL (SVC 202 in VM/370). BREXX can't run a subroutine that is part of EE (without some tricks :-).
Bob

On Tue, Nov 8, 2022 at 11:19 AM Martin Scheffler <San-Lorenzo@...> wrote:
On Tue, Nov 8, 2022 at 04:52 PM, Harold Grovesteen wrote:
can you help me understand how we ended up with two distinct C runtime environments?
It is the dynamic data, not the code.

  • a user "kicks" CMS to start EE, EE initializes its runtime data
  • EE calls CMS for macro execution
  • CMS sees "/*" and starts bREXX, bREXX initializes its very own runtime data
  • the macro wants to execute an EE subcommand, EE had setup itself as subcommand handler before
  • CMS calls EE's subcommand handler, but has no knowledge about EE's already existing runtime data

IBM had to solve this problem when they made XEDIT, EXEC 2 did the job on VM/SP 1+2


 

The spirit has left the bottle and will never return: EE has run its first REXX macro.

This version is still incomplete and not stable enough for public display.
Now there is MUCH legwork to be done with the EXTRACT command ... and all existing EE commands have to "learn" how to provide an XEDIT-compatible return code.

Martin

The REXX macro below produces the same results on LCM+L's VM/SP Release 5.


File: PRIMEXED LISTING? A1?? RECFM: V LRECL: 125(125) Lines:? 100 Current:?? 12?
?====>???????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *????????????????????????????????????????????????? ?
??? 1 1 is prime?????????????????????????????????????????????????????????????? ?
??? 2 2 is prime?????????????????????????????????????????????????????????????? ?
??? 3 3 is prime?????????????????????????????????????????????????????????????? ?
??? 4 4 = 2*2????????????????????????????????????????????????????????????????? ?
??? 5 5 is prime?????????????????????????????????????????????????????????????? ?
??? 6 6 = 2*3????????????????????????????????????????????????????????????????? ?
??? 7 7 is prime?????????????????????????????????????????????????????????????? ?
??? 8 8 = 2*2*2??????????????????????????????????????????????????????????????? ?
??? 9 9 = 3*3????????????????????????????????????????????????????????????????? ?
?? 10 10 = 2*5???????????????????????????????????????????????????????????????? ?
?? 11 11 is prime????????????????????????????????????????????????????????????? ?
?? 12 12 = 2*2*3?????????????????????????????????????????????????????????????? ?
?? 13 13 is prime????????????????????????????????????????????????????????????? ?
?? 14 14 = 2*7???????????????????????????????????????????????????????????????? ?
?? 15 15 = 3*5???????????????????????????????????????????????????????????????? ?
?? 16 16 = 2*2*2*2???????????????????????????????????????????????????????????? ?
?? 17 17 is prime????????????????????????????????????????????????????????????? ?
?? 18 18 = 2*3*3?????????????????????????????????????????????????????????????? ?
?? 19 19 is prime????????????????????????????????????????????????????????????? ?
?? 20 20 = 2*2*5?????????????????????????????????????????????????????????????? ?
?? 21 21 = 3*7???????????????????????????????????????????????????????????????? ?
?? 22 22 = 2*11??????????????????????????????????????????????????????????????? ?
?? 23 23 is prime????????????????????????????????????????????????????????????? ?
Modified?????????????????????????????????? XeDiT V1.3.0_221112-0730,? 6 File(s)
?
?????????????????????????????????????????????????????????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
File: PRIMEXED EXEC???? A1?? RECFM: V LRECL: 125(255) Lines:?? 33 Current:?? 12
?
?====>???????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *????????????????????????????????????????????????? ?
??? 1 /* REXX */?????????????????????????????????????????????????????????????? ?
??? 2 address "XEDIT"????????????????????????????????????????????????????????? ?
??? 3????????????????????????????????????????????????????????????????????????? ?
??? 4 default = 23???????????????????????????????????????????????????????????? ?
??? 5 parse arg limit .??????????????????????????????????????????????????????? ?
??? 6 if datatype(limit,"W") = 0 then limit = default????????????????????????? ?
??? 7 if limit < 7 then limit = default??????????????????????????????????????? ?
??? 8 prime. = "0"???????????????????????????????????????????????????????????? ?
??? 9 number. = "0"??????????????????????????????????????????????????????????? ?
?? 10????????????????????????????????????????????????????????????????????????? ?
?? 11 "bottom"???????????????????????????????????????????????????????????????? ?
?? 12 do i = 1 to limit??????????????????????????????????????????????????????? ?
?? 13?? is_prime = 1 /* in the beginning we assume it is prime */????????????? ?
?? 14?? factors = ""?????????????????????????????????????????????????????????? ?
?? 15?? m = i????????????????????????????????????????????????????????????????? ?
?? 16?? do j = 2 to prime.0??????????????????????????????????????????????????? ?
?? 17???? do forever?????????????????????????????????????????????????????????? ?
?? 18?????? if (m // prime.j) <> 0 then leave????????????????????????????????? ?
?? 19?????? is_prime = 0?????????????????????????????????????????????????????? ?
?? 20?????? factors = factors"*"prime.j??????????????????????????????????????? ?
?? 21?????? m = m % prime.j??????????????????????????????????????????????????? ?
?? 22???? end????????????????????????????????????????????????????????????????? ?
?? 23?? end??????????????????????????????????????????????????????????????????? ?
?? 24?? if is_prime = 1 then do??????????????????????????????????????????????? ?
?? 25???? k = prime.0 + 1????????????????????????????????????????????????????? ?
?? 26???? prime.k = i????????????????????????????????????????????????????????? ?
?? 27???? prime.0 = k????????????????????????????????????????????????????????? ?
?? 28???? "input" i "is prime"???????????????????????????????????????????????? ?
?? 29?? end??????????????????????????????????????????????????????????????????? ?
?? 30?? else do??????????????????????????????????????????????????????????????? ?
?? 31???? "input" i "=" substr(factors,2)????????????????????????????????????? ?
?? 32?? end??????????????????????????????????????????????????????????????????? ?
?? 33 end????????????????????????????????????????????????????????????????????? ?
?? 34 * * * End of File * * *????????????????????????????????????????????????? ?
Unchanged????????????????????????????????? XeDiT V1.3.0_221112-0730,? 7 File(s)
?


 

CONGRATULATIONS!!!


On Sat, Nov 12, 2022, 01:39 Martin Scheffler <San-Lorenzo@...> wrote:
The spirit has left the bottle and will never return: EE has run its first REXX macro.

This version is still incomplete and not stable enough for public display.
Now there is MUCH legwork to be done with the EXTRACT command ... and all existing EE commands have to "learn" how to provide an XEDIT-compatible return code.

Martin

The REXX macro below produces the same results on LCM+L's VM/SP Release 5.


File: PRIMEXED LISTING? A1?? RECFM: V LRECL: 125(125) Lines:? 100 Current:?? 12?
?====>???????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *????????????????????????????????????????????????? ?
??? 1 1 is prime?????????????????????????????????????????????????????????????? ?
??? 2 2 is prime?????????????????????????????????????????????????????????????? ?
??? 3 3 is prime?????????????????????????????????????????????????????????????? ?
??? 4 4 = 2*2????????????????????????????????????????????????????????????????? ?
??? 5 5 is prime?????????????????????????????????????????????????????????????? ?
??? 6 6 = 2*3????????????????????????????????????????????????????????????????? ?
??? 7 7 is prime?????????????????????????????????????????????????????????????? ?
??? 8 8 = 2*2*2??????????????????????????????????????????????????????????????? ?
??? 9 9 = 3*3????????????????????????????????????????????????????????????????? ?
?? 10 10 = 2*5???????????????????????????????????????????????????????????????? ?
?? 11 11 is prime????????????????????????????????????????????????????????????? ?
?? 12 12 = 2*2*3?????????????????????????????????????????????????????????????? ?
?? 13 13 is prime????????????????????????????????????????????????????????????? ?
?? 14 14 = 2*7???????????????????????????????????????????????????????????????? ?
?? 15 15 = 3*5???????????????????????????????????????????????????????????????? ?
?? 16 16 = 2*2*2*2???????????????????????????????????????????????????????????? ?
?? 17 17 is prime????????????????????????????????????????????????????????????? ?
?? 18 18 = 2*3*3?????????????????????????????????????????????????????????????? ?
?? 19 19 is prime????????????????????????????????????????????????????????????? ?
?? 20 20 = 2*2*5?????????????????????????????????????????????????????????????? ?
?? 21 21 = 3*7???????????????????????????????????????????????????????????????? ?
?? 22 22 = 2*11??????????????????????????????????????????????????????????????? ?
?? 23 23 is prime????????????????????????????????????????????????????????????? ?
Modified?????????????????????????????????? XeDiT V1.3.0_221112-0730,? 6 File(s)
?
?????????????????????????????????????????????????????????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
File: PRIMEXED EXEC???? A1?? RECFM: V LRECL: 125(255) Lines:?? 33 Current:?? 12
?
?====>???????????????????????????????????????????????????????????????????????? ?
??? 0 * * * Top of File * * *????????????????????????????????????????????????? ?
??? 1 /* REXX */?????????????????????????????????????????????????????????????? ?
??? 2 address "XEDIT"????????????????????????????????????????????????????????? ?
??? 3????????????????????????????????????????????????????????????????????????? ?
??? 4 default = 23???????????????????????????????????????????????????????????? ?
??? 5 parse arg limit .??????????????????????????????????????????????????????? ?
??? 6 if datatype(limit,"W") = 0 then limit = default????????????????????????? ?
??? 7 if limit < 7 then limit = default??????????????????????????????????????? ?
??? 8 prime. = "0"???????????????????????????????????????????????????????????? ?
??? 9 number. = "0"??????????????????????????????????????????????????????????? ?
?? 10????????????????????????????????????????????????????????????????????????? ?
?? 11 "bottom"???????????????????????????????????????????????????????????????? ?
?? 12 do i = 1 to limit??????????????????????????????????????????????????????? ?
?? 13?? is_prime = 1 /* in the beginning we assume it is prime */????????????? ?
?? 14?? factors = ""?????????????????????????????????????????????????????????? ?
?? 15?? m = i????????????????????????????????????????????????????????????????? ?
?? 16?? do j = 2 to prime.0??????????????????????????????????????????????????? ?
?? 17???? do forever?????????????????????????????????????????????????????????? ?
?? 18?????? if (m // prime.j) <> 0 then leave????????????????????????????????? ?
?? 19?????? is_prime = 0?????????????????????????????????????????????????????? ?
?? 20?????? factors = factors"*"prime.j??????????????????????????????????????? ?
?? 21?????? m = m % prime.j??????????????????????????????????????????????????? ?
?? 22???? end????????????????????????????????????????????????????????????????? ?
?? 23?? end??????????????????????????????????????????????????????????????????? ?
?? 24?? if is_prime = 1 then do??????????????????????????????????????????????? ?
?? 25???? k = prime.0 + 1????????????????????????????????????????????????????? ?
?? 26???? prime.k = i????????????????????????????????????????????????????????? ?
?? 27???? prime.0 = k????????????????????????????????????????????????????????? ?
?? 28???? "input" i "is prime"???????????????????????????????????????????????? ?
?? 29?? end??????????????????????????????????????????????????????????????????? ?
?? 30?? else do??????????????????????????????????????????????????????????????? ?
?? 31???? "input" i "=" substr(factors,2)????????????????????????????????????? ?
?? 32?? end??????????????????????????????????????????????????????????????????? ?
?? 33 end????????????????????????????????????????????????????????????????????? ?
?? 34 * * * End of File * * *????????????????????????????????????????????????? ?
Unchanged????????????????????????????????? XeDiT V1.3.0_221112-0730,? 7 File(s)
?


 

On Sat, Nov 12, 2022 at 08:39 AM, Martin Scheffler wrote:
EE has run its first REXX macrofi
I have received a personal e-mail, but I cannot reply at the moment for technical reasons. I am fire-fighting my Windows PC for several hours, I cannot use git and I cannot write e-mails. I DO NOT WANT TO REBOOT, NOT NOW. Please be patient.

Martin