• How do I compile a C program?

    From Johann 'Myrkraverk' Oskarsson@21:1/5 to All on Fri Oct 25 12:28:57 2019
    Dear c.s.i.a.misc,

    I am using the public access system, pub400.com.

    How do I go about compiling a C program. I believe I've entered it
    correctly in myrkravrk1/qcsrc, member named hello. See below.

    Then I believe I should be able to compile with

    crtcmod module(myrkravrk1/hello) srcfile(myrkravrk1/qcsrc)

    but all I get is the message

    Module HELLO is not created because statement errors occurred.

    and I don't know what that means. Is this an error in my command line,
    or a compilation error?

    I am very new to System I, or AS/400. And I'm just starting to get the
    various concepts of libraries, files, and members. A screenshot follows
    with truncated columns.

    Columns . . . : 1 80 Edit MYRKRAVRK1/QCSRC
    SEU==> HELLO
    FMT ** ...+... 1 <snip> ...+... 8

    *************** Beginning of data ********
    001.00 #include <stdio.h> 191025

    002.00 void main( void ) 191025

    003.00 { 191025

    004.00 printf( "Hello, world\n" ); 191025

    005.00 } 191025

    ****************** End of data **********

    Am I correctly referring the source file on my command line?

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jonathan Bailey@21:1/5 to Johann 'Myrkraverk' Oskarsson on Fri Oct 25 01:11:30 2019
    On Friday, 25 October 2019 05:29:02 UTC+1, Johann 'Myrkraverk' Oskarsson wrote:
    Dear c.s.i.a.misc,

    I am using the public access system, pub400.com.

    How do I go about compiling a C program. I believe I've entered it
    correctly in myrkravrk1/qcsrc, member named hello. See below.

    Then I believe I should be able to compile with

    crtcmod module(myrkravrk1/hello) srcfile(myrkravrk1/qcsrc)

    but all I get is the message

    Module HELLO is not created because statement errors occurred.

    and I don't know what that means. Is this an error in my command line,
    or a compilation error?

    I am very new to System I, or AS/400. And I'm just starting to get the various concepts of libraries, files, and members. A screenshot follows
    with truncated columns.

    Columns . . . : 1 80 Edit MYRKRAVRK1/QCSRC
    SEU==> HELLO
    FMT ** ...+... 1 <snip> ...+... 8

    *************** Beginning of data ********
    001.00 #include <stdio.h> 191025

    002.00 void main( void ) 191025

    003.00 { 191025

    004.00 printf( "Hello, world\n" ); 191025

    005.00 } 191025

    ****************** End of data **********

    Am I correctly referring the source file on my command line?

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    It works OK for me just replacing myrkraverk with baileyj.
    You can do a few things:
    type dspjoblog at a command line then F10 and page up. This might show some errors
    add OUTPUT(*print) to the crtcmod command (hint press F4 before enter then F9 and you can explore a whole range of extras)
    After that type wrksplf at a command line. then select the spoolfile with option 5 and that should show the errors. You might find the {} are mangled by the CCSID settings. That might require changing your job or re-creating qcsrc.
    Last, you should probably use crtbndc which will generate a program which you can call with
    call myrkravrk1/hello
    modules cannot be called, only merged with other modules into programs or service programs. Or copied/deleted/saved to tape etc.

    HTH
    Jonathan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to Jonathan Bailey on Fri Oct 25 16:32:21 2019
    On 25/10/2019 4:11 pm, Jonathan Bailey wrote:
    You might find the {} are mangled by the CCSID settings. That might require changing your job or re-creating qcsrc.
    Indeed that is the problem.

    3 > crtcmod module(myrkravrk1/hello) srcfile(myrkravrk1/qcsrc)
    MYRKRAVRK1/QCSRC(HELLO), 3.1: CZM0191(20) The character {
    is not a valid C source character.
    MYRKRAVRK1/QCSRC(HELLO), 5.1: CZM0191(20) The character }
    is not a valid C source character.
    MYRKRAVRK1/QCSRC(HELLO), 4.3: CZM0046(30) Syntax error.
    Module HELLO is not created because statement errors occurred.
    The compilation failed.

    How would I go about "changing my job" or "recreating qcsrc?"

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to Johann 'Myrkraverk' Oskarsson on Fri Oct 25 16:51:06 2019
    On 25/10/2019 4:32 pm, Johann 'Myrkraverk' Oskarsson wrote:
    How would I go about "changing my job" or "recreating qcsrc?"

    A quick google led me to this:


    https://www.code400.com/forum/forum/iseries-programming-languages/any-thing-goes/12139-the-character-%7D-is-not-a-valid-c-source-character

    Which suggests it's a problem with my terminal encoding. I am using
    Mocha TN5250 for Windows. My AS/400 code page is set to US(037) and
    locally I have checked "Use Windows OS default encoding." Are these
    settings relevant to the { } characters being wrong?

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to Johann 'Myrkraverk' Oskarsson on Fri Oct 25 16:56:29 2019
    On 25/10/2019 4:51 pm, Johann 'Myrkraverk' Oskarsson wrote:
    Which suggests it's a problem with my terminal encoding.  I am using
    Mocha TN5250 for Windows.  My AS/400 code page is set to US(037) and
    locally I have checked "Use Windows OS default encoding."  Are these settings relevant to the { } characters being wrong?

    Indeed it is, after setting the AS/400 code page to Austria/Germany
    (273) and editing my source file, I have successfully compiled the module.


    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to Jonathan Bailey on Fri Oct 25 17:03:51 2019
    On 25/10/2019 4:11 pm, Jonathan Bailey wrote:
    Last, you should probably use crtbndc which will generate a program which you can call with
    call myrkravrk1/hello

    Indeed, I've done this now; thank you.

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jonathan Bailey@21:1/5 to Johann 'Myrkraverk' Oskarsson on Fri Oct 25 03:15:15 2019
    On Friday, 25 October 2019 10:03:57 UTC+1, Johann 'Myrkraverk' Oskarsson wrote:
    On 25/10/2019 4:11 pm, Jonathan Bailey wrote:
    Last, you should probably use crtbndc which will generate a program which you can call with
    call myrkravrk1/hello

    Indeed, I've done this now; thank you.

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    Great
    Well done
    Next stop RPG :)

    Jonathan.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)