Absent Member.
Absent Member.
2697 views

file hander between command line and jvm cobol

Jump to solution

A question about file hander between command line and jvm cobol.

environments description

os:windows7

dev IDE: Micro Focus Enterprise Developer 2.2 Update 2 for Eclipse

projects:there are 2 projects

        1,pure java project (1 source only)

        2,jvm cobol project(1 source only) 

now,execute the program by the below order

    command line → jar(pure java project) → jar(jvm mfcobol project)

but below error was happed.

-----------------------------------------------the below-is--full test source---------------------------------------------------------------------

ttt.bat file:

--start-------------------------------

set JDK_PATH = "C:\Program Files\Java\jre7\bin"
set CLSPATH = %CLSPATH%;"C:\bat\xxx\mfcobol.jar;C:\bat\xxx\mfcobolrts.jar;C:\bat\xxx\mfsqljvm.jar;
set CLSPATH = %CLSPATH%;"C:\bat\xxx\test1.jar;C:\bat\xxx\test2.jar;C:\bat\xxx\cblrtsm.dll"
%JDK_PATH%\java -Xms128m -Xmx512m -cp %CLSPATH% -Djava.library.path=C:\bat\xxx TESTJVMCOBFILE
pause

-----end----------------------------

pure java source

----start----------------------------

public class TESTJVMCOBFILE {

public TESTJVMCOBFILE() {
// TODO Auto-generated constructor stub
}

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub
String file1 = "C:\\bat\\temp\\dat\\dat1.txt";
TESTFILE tf = new TESTFILE();
tf.instanceMethod(file1);
System.out.println("OK");

}

}

----end-------------------------

jvm mf cobol project

---start--------------------

class-id TESTFILE public.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
OBJECT-COMPUTER.
PROGRAM COLLATING SEQUENCE IS EBCDIC-CODE.
SPECIAL-NAMES.
ALPHABET EBCDIC-CODE IS EBCDIC.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUT1-F ASSIGN to dynamic OW1-SYSOUT
ORGANIZATION IS LINE SEQUENTIAL
file status is ws-file-status.

FILE SECTION.
FD OUT1-F.
01 OUT1-REC.
02 OUT1-CARDNO PIC N(11) USAGE NATIONAL.


working-storage section.
01 OW1-SYSOUT PIC X(255).
01 ws-file-status PIC XX.


method-id instanceMethod.
LINKAGE SECTION.
01 OW1 PIC X(255).

procedure division USING BY VALUE OW1.

MOVE OW1 TO OW1-SYSOUT.
INITIALIZE OUT1-REC.
OPEN OUTPUT OUT1-F.

MOVE "123456" TO OUT1-REC.
WRITE OUT1-REC.
CLOSE OUT1-F.

goback.
end method.

end class.

---end--------------------

if directly execute the above source without ttt.bat in the eclipse dev IDE,it is works.

but use command line source(ttt.bat),like that above image was displayed.

It's important that my project must dymanic setting full filepath to cobol in the pure java source.

who can help me?

I'm waitting for your replySleep

 

0 Likes
2 Solutions

Accepted Solutions
Absent Member.
Absent Member.

Are you executing this in a Micro Focus command prompt?  It appears that perhaps the micro focus environment is not properly setup.  in the root directory for the micro focus tools you should find a bat file called createnv.bat run that prior to TTT.BAT and see if that may fix it.  The other possibility is are you running 32 bit or 64 bit. Check the java bit size matches the Micro Focus program.  Both 32 or both 64

View solution in original post

0 Likes
Absent Member.
Absent Member.

Stevew,Thanks for your prompting.

the below source is tested and it's ok! double click ttt.bat,that file is created!

------start----------------ttt.bat-------------------------------

---↓--must--setting-envirnment------------------------------------------------

@echo off

rem Create Visual COBOL Environment

if "%1" == "64" (

"C:\Progra~1\MicroF~1\Enterp~1\bin64\cblpromp.exe" >> "%temp%\setenv.bat"

) else (

"C:\Progra~1\MicroF~1\Enterp~1\bin\cblpromp.exe" >> "%temp%\setenv.bat"

)

call "%temp%\setenv.bat"

del /q "%temp%\setenv.bat"

rem check for vista and server 2008 documents folder

if exist "%USERPROFILE%"\Documents set mydocs=%USERPROFILE%\Documents

if not exist "%USERPROFILE%"\Documents set mydocs=%USERPROFILE%\My Documents

cd /d "%mydocs%\

set mydocs=

---↑--must--setting-envirnment------------------------------------------------

---↓-self source-----------------------------------------------------------

call C:\Progra~1\Java\jre7\bin\java -cp C:\bat\xxx\mfcobol.jar;C:\bat\xxx\mfcobolrts.jar;C:\bat\xxx\mfsqljvm.jar;C:\bat\xxx\test1.jar;C:\bat\xxx\test2.jar TESTJVMCOBFILE

echo "ok"

pause

-----end-----------------------------------------------------

View solution in original post

0 Likes
3 Replies
Absent Member.
Absent Member.

Are you executing this in a Micro Focus command prompt?  It appears that perhaps the micro focus environment is not properly setup.  in the root directory for the micro focus tools you should find a bat file called createnv.bat run that prior to TTT.BAT and see if that may fix it.  The other possibility is are you running 32 bit or 64 bit. Check the java bit size matches the Micro Focus program.  Both 32 or both 64

View solution in original post

0 Likes
Absent Member.
Absent Member.

Stevew,Thanks for your reply.

I open the Micro Focus command prompt window and execute ttt.bat and it's works and file is created.

but,like below I written in the test.bat and executing in the windows prompt.

   C:\Progra~1\MicroF~1\Enterp~1\bin\cblpromp.exe /k 'C:\bat\bat\bki\ttt.bat'

   pause

the file [C:\bat\temp\dat\dat1.txt] is still not created.

how to call Micro Focus command prompt in the bat source?

0 Likes
Absent Member.
Absent Member.

Stevew,Thanks for your prompting.

the below source is tested and it's ok! double click ttt.bat,that file is created!

------start----------------ttt.bat-------------------------------

---↓--must--setting-envirnment------------------------------------------------

@echo off

rem Create Visual COBOL Environment

if "%1" == "64" (

"C:\Progra~1\MicroF~1\Enterp~1\bin64\cblpromp.exe" >> "%temp%\setenv.bat"

) else (

"C:\Progra~1\MicroF~1\Enterp~1\bin\cblpromp.exe" >> "%temp%\setenv.bat"

)

call "%temp%\setenv.bat"

del /q "%temp%\setenv.bat"

rem check for vista and server 2008 documents folder

if exist "%USERPROFILE%"\Documents set mydocs=%USERPROFILE%\Documents

if not exist "%USERPROFILE%"\Documents set mydocs=%USERPROFILE%\My Documents

cd /d "%mydocs%\

set mydocs=

---↑--must--setting-envirnment------------------------------------------------

---↓-self source-----------------------------------------------------------

call C:\Progra~1\Java\jre7\bin\java -cp C:\bat\xxx\mfcobol.jar;C:\bat\xxx\mfcobolrts.jar;C:\bat\xxx\mfsqljvm.jar;C:\bat\xxx\test1.jar;C:\bat\xxx\test2.jar TESTJVMCOBFILE

echo "ok"

pause

-----end-----------------------------------------------------

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.