The C source program exists as a POSIX source file with the name hello.c
in the directory /USERIDXY/source
. The program uses POSIX library functions. The compiler generates an LLM and writes it to a POSIX object file with the default name hello.o
. This object file is stored in the directory of the source program. The object file is then processed further in the POSIX shell environment.
Source program file hello.c
#include <stdio.h> FILE *fp; int main(void) { printf("Hello, I am a C program\n"); fp = fopen("/USERIDXY/posixfiles/hello", "w"); fputs("hello", fp); fclose(fp); return 0; }
The source program was created with EDT and saved with the statement @XWRITE FILE=/USERIDXY/source/hello.c.
Runtime listing for compilation, linkage and execution
(IN) indicates user inputs (OUT) indicates system program messages (IN) /START-CPLUS-COMPILER —————————————————————————————————————————— (1) (OUT) % BLS0523 ELEMENT ’SDFCC’, VERSION ’04.0B02’, TYPE ’L’ FROM LIBRARY ’:P401:$TSOS.SYSLNK.CPP.040’ IN PROCESS (OUT) % BLS0524 LLM ’SDFCC’, VERSION ’04.0B02’ OF ’2023-04-02 13:40:11’ LOADED (OUT) % BLS0551 COPYRIGHT (C) 2023 Fujitsu Technology Solutions GmbH. ALL RIGHTS RESERVED (OUT) % CDR9992 : BEGIN C/C++ VERSION 04.0B02 (IN) //MOD-SOURCE-PROP LANG=*C,DEFINE=_OSD_POSIX ———————————————————— (2) (IN) //MOD-INCL-LIB STD-INCL=($.SYSLIB.POSIX-HEADER,*STANDARD-LIB) —— (3) (IN) //COMPILE SOURCE='/USERIDXY/source/hello.c',- //MODULE-OUTPUT=*SOURCE-LOC ———————————————————————————————————— (4) (OUT) % CDR9907 : NOTES: 0 WARNINGS: 0 ERRORS: 0 FATALS: 0 (OUT) % CDR9937 : MODULES GENERATED, CPU TIME USED: 0.3829 SECONDS (IN) //END —————————————————————————————————————————————————————————— (5) (OUT) % CDR9936 END; SUMMARY: NOTES: 0 WARNINGS: 0 ERRORS: 0 FATALS: 0 (OUT) % CCM0998 CPU TIME USED: 0.3829 SECONDS
(IN) /START-POSIX-SHELL ————————————————————————————————————————————— (6) (OUT) POSIX Basisshell 10.0A45 created Jun 14 2016 POSIX Shell 10.0A45 created Jul 12 2016 Copyright (C) Fujitsu Technology Solutions 2009 All Rights reserved Last login: Thu Mar 26 10:45:44 2020 on term/002 (IN) cd source —————————————————————————————————————————————————————— (7) (IN) ls hello* —————————————————————————————————————————————————————— (8) (OUT) hello.c hello.o (IN) cc hello.o ————————————————————————————————————————————————————— (9) (IN) a.out —————————————————————————————————————————————————————————— (10) (OUT) Hello, I am a C program
(1) | The compiler run is started. |
(2) | The MODIFY-SOURCE-PROPERTIES statement activates the C language mode (the C++ mode is set by default) and sets the |
(3) | The library containing the standard headers for POSIX library functions is assigned with the MODIFY-INCLUDE-LIBRARY statement in addition to the CRTE library $.SYSLNK.CRTE (*STANDARD-LIBRARY). |
(4) | The COMPILE statement is issued to start the compilation run. The absolute path name of the POSIX source file to be compiled is specified with the SOURCE option. POSIX file names must always be enclosed within single quotes. The operand value *SOURCE-LOCATION in the MODULE-OUTPUT option causes the compiled module to be written to a POSIX object file with the default name |
(5) | The compiler run is terminated with the END statement. |
(6) | Since POSIX object files can only be processed further in the POSIX subsystem, the POSIX command START-POSIX-SHELL is used to switch from the BS2000 system environment (SDF) to the POSIX environment (shell). The call places the user in the home directory of the current BS2000 user ID (USERIDXY). |
(7) | The POSIX command |
(8) | On entering the POSIX command |
(9) | The POSIX command |
(10) | The program is executed. |