Sorry, my english is horrible.
I tried to use some aplications like this and always
have the same error at compling with Powercobol v.4.2.
I want to read from un aplication who is the user in the net
using my application.Thanks Horacio.
IDENTIFICATION DIVISION.
PROGRAM-ID. GetUserName.
author. T Erin Kelley 9/14/99.
environment division.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USERBUF PIC X(256).
01 BUFLEN PIC 9(9) COMP-5.
linkage section.
01 user-name pic x(255).
01 len-user-name pic 9(9) comp-5.
01 return-value pic s9(9) comp-5.
PROCEDURE DIVISION using user-name, len-user-name, return-value.
PR.
MOVE ALL X'00' TO USERBUF.
compute buflen = function length(userbuf)
*
* Get the user's name
*
CALL "GetUserNameA" WITH STDCALL USING *> Note - Change to "GetUserName" for use on NT
by reference USERBUF
by reference BUFLEN
returning return-value
if return-value = 0
move 1 to return-value
move spaces to user-name
move 0 to len-user-name
exit program
end-if
* Remove the trailing null byte from USERBUF
compute len-user-name = buflen - 1
move userbuf (1 : len-user-name) to user-name
move 0 to return-value
display user-name
exit program.
END PROGRAM GetUserName.
Create C:\cobol visual\Mainuser\Debug\MainForm.cob...
STATISTICS: HIGHEST SEVERITY CODE=I
Compile C:\cobol visual\Mainuser\Debug\MainForm.cob...
** DIAGNOSTIC MESSAGE ** (MAINFORM)
MainForm CmCommand1-Click(37) : JMN1044I-S PROGRAM CONTAINED WITHIN PROGRAM 'MAINFORM' MUST END WITH END PROGRAM HEADER. END PROGRAM HEADER ASSUMED.
STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1
** The build has failed **
I tried to use some aplications like this and always
have the same error at compling with Powercobol v.4.2.
I want to read from un aplication who is the user in the net
using my application.Thanks Horacio.
IDENTIFICATION DIVISION.
PROGRAM-ID. GetUserName.
author. T Erin Kelley 9/14/99.
environment division.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USERBUF PIC X(256).
01 BUFLEN PIC 9(9) COMP-5.
linkage section.
01 user-name pic x(255).
01 len-user-name pic 9(9) comp-5.
01 return-value pic s9(9) comp-5.
PROCEDURE DIVISION using user-name, len-user-name, return-value.
PR.
MOVE ALL X'00' TO USERBUF.
compute buflen = function length(userbuf)
*
* Get the user's name
*
CALL "GetUserNameA" WITH STDCALL USING *> Note - Change to "GetUserName" for use on NT
by reference USERBUF
by reference BUFLEN
returning return-value
if return-value = 0
move 1 to return-value
move spaces to user-name
move 0 to len-user-name
exit program
end-if
* Remove the trailing null byte from USERBUF
compute len-user-name = buflen - 1
move userbuf (1 : len-user-name) to user-name
move 0 to return-value
display user-name
exit program.
END PROGRAM GetUserName.
Create C:\cobol visual\Mainuser\Debug\MainForm.cob...
STATISTICS: HIGHEST SEVERITY CODE=I
Compile C:\cobol visual\Mainuser\Debug\MainForm.cob...
** DIAGNOSTIC MESSAGE ** (MAINFORM)
MainForm CmCommand1-Click(37) : JMN1044I-S PROGRAM CONTAINED WITHIN PROGRAM 'MAINFORM' MUST END WITH END PROGRAM HEADER. END PROGRAM HEADER ASSUMED.
STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1
** The build has failed **