Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix looping bat files and add support for non-default file extensions #591

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions bat/ASM.BAT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if /I "%1" == "tron" (echo on) else (echo off)
rem asm run macro assembly to generate relocatable obj from mlc source
rem asm run macro assembly to generate relocatable obj from MLC source

setlocal
if /I "%1" == "tron" (set z_TraceMode=tron
Expand All @@ -11,20 +11,23 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of MLC file to assemble:
) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.MLC goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .MLC. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.MLC goto file_ok
echo %0 ERROR: %z_file%.MLC was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of MLC
set z_fext=.MLC
if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
if exist %z_file%.BAL erase %z_file%.BAL
Expand All @@ -41,7 +44,7 @@ rem get the z390 directory
set "z_HomeDir=%~dps0..\"
for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"

call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0mz390 %z_TraceMode% %z_file%%z_fext% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by mz390
if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ)
Expand All @@ -55,7 +58,9 @@ exit /b %z_ReturnCode%
echo .
echo the ASM.BAT procedure is intended to assemble a single assembler program
echo .
set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of source file to assemble:
if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
29 changes: 17 additions & 12 deletions bat/ASML.BAT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if /I "%1" == "tron" (echo on) else (echo off)
rem asml assemble and link to generate load module 390 from mlc
rem asml assemble and link to generate load module 390 from MLC

setlocal
if /I "%1" == "tron" (set z_TraceMode=tron
Expand All @@ -11,20 +11,23 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble and link:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of MLC file to assemble and link:
) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.MLC goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .MLC. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.MLC goto file_ok
echo %0 ERROR: %z_file%.MLC was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of MLC
set z_fext=.MLC
if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
if exist %z_file%.BAL erase %z_file%.BAL
Expand All @@ -41,7 +44,7 @@ rem get the z390 directory
set "z_HomeDir=%~dps0..\"
for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"

call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0mz390 %z_TraceMode% %z_file%%z_fext% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by mz390
if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ)
Expand All @@ -61,7 +64,9 @@ exit /b %z_ReturnCode%
echo .
echo the ASML.BAT procedure is intended to assemble and link a single assembler program
echo .
set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble and link:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of MLC file to assemble and link:
if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
29 changes: 17 additions & 12 deletions bat/ASMLG.BAT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if /I "%1" == "tron" (echo on) else (echo off)
rem asmlg assemble, link, and go from mlc to 390 execution
rem asmlg assemble, link, and go from MLC to 390 execution

setlocal
if /I "%1" == "tron" (set z_TraceMode=tron
Expand All @@ -11,20 +11,23 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble, link, and execute:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of MLC file to assemble, link, and execute:
) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.MLC goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .MLC. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.MLC goto file_ok
echo %0 ERROR: %z_file%.MLC was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of MLC
set z_fext=.MLC
if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
if exist %z_file%.BAL erase %z_file%.BAL
Expand All @@ -41,7 +44,7 @@ rem get the z390 directory
set "z_HomeDir=%~dps0..\"
for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"

call %~dps0mz390 %z_TraceMode% %z_file% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0mz390 %z_TraceMode% %z_file%%z_fext% sysmac(+%z_HomeDir%mac) syscpy(+%z_HomeDir%mac) %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by mz390
if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (if exist %z_file%.OBJ (erase %z_file%.OBJ)
Expand All @@ -65,7 +68,9 @@ exit /b %z_ReturnCode%
echo .
echo the ASMLG.BAT procedure is intended to assemble, link, and execute a single assembler program
echo .
set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble, link, and execute:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of MLC file to assemble, link, and execute:
if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
27 changes: 16 additions & 11 deletions bat/ASSIST.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,31 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of mlc file to assemble, link, and execute:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of MLC file to assemble, link, and execute:
) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.MLC goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .MLC. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.MLC goto file_ok
echo %0 ERROR: %z_file%.MLC was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of MLC
set z_fext=.MLC
if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
set XREAD=%z_file%.XRD
set XPRNT=%z_file%.XPR
set XPNCH=%z_file%.XPH
set XGET=%z_file%.XGT
set XPUT=%z_file%.XPT
call %~dps0ASMLG %z_TraceMode% %z_file% assist %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0ASMLG %z_TraceMode% %z_file%%z_fext% assist %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by asmlg

Expand All @@ -44,7 +47,9 @@ exit /b %z_ReturnCode%
echo .
echo the ASSIST.BAT procedure is intended to assemble, link, and execute a single assembler program
echo .
set /P z_file=Hit Enter for more help or suppply name of mlc file to assemble, link, and execute:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of MLC file to assemble, link, and execute:
if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
6 changes: 4 additions & 2 deletions bat/BLDJAR.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ rem back to z390 root dir
cd ..

rem unless suppressed, generate javadoc.
if /I %z_docs% EQU Y call bat\BLDJVDOC.BAT
if /I %z_docs% EQU Y call bat\BLDJVDOC.BAT %z_TraceMode%
if /I %z_docs% EQU Y set z_ReturnCode=%ERRORLEVEL%
if %z_ReturnCode% NEQ 0 goto return
echo .

if /I %z_docs% EQU Y (set z_msg=z390.jar and javadoc have been created okay
) else (set z_msg=z390.jar has been created okay
)
if exist z390.jar echo %0 %z_msg%
if exist jar\z390.jar (copy jar\z390.jar .\z390.jar /B /V /Y
echo %0 %z_msg%
)

:return
popd
Expand Down
27 changes: 16 additions & 11 deletions bat/CBLC.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of cbl file to compile:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of cbl file to compile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbl should be CBL.

) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.CBL goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .CBL. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.CBL goto file_ok
echo %0 ERROR: %z_file%.CBL was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of cbl
set z_fext=.cbl
Comment on lines +25 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 25-26. cbl should be CBL.

if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
if exist %z_file%.MLC erase %z_file%.MLC
Expand All @@ -44,7 +47,7 @@ rem get the z390 directory
set "z_HomeDir=%~dps0..\"
for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"

call %~dps0ZC390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0ZC390 %z_TraceMode% %z_file%%z_fext% %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by zc390
if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (erase %z_file%.MLC
Expand All @@ -64,7 +67,9 @@ exit /b %z_ReturnCode%
echo .
echo the CBLC.BAT procedure is intended to compile a single cobol program
echo .
set /P z_file=Hit Enter for more help or suppply name of cbl file to compile:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of cbl file to compile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbl should be CBL.

if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
27 changes: 16 additions & 11 deletions bat/CBLCL.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ if /I "%1" == "tron" (set z_TraceMode=tron
set /A z_NestLevel=%z_NestLevel%+1
rem ----- Lvl(%z_NestLevel%) Start %0 %1 %2 %3 %4 %5 %6 %7 %8 %9

if /I %1. == . (set /P z_file=Hit Enter for help or suppply name of cbl file to compile and link:
if /I %1. == . (set /P z_file=Hit Enter for help or supply name of cbl file to compile and link:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbl should be CBL.

) else (set z_file=%1)
if /I %z_file%. == . goto help
:chkfile
rem convert Unix path notation to Windows before checking the file
set z_file=%z_file:/=\%
if exist %z_file%.CBL goto file_ok
rem if user specified valid extension, strip it off
if /I %z_file:~-4%. NEQ .CBL. goto help
set z_file=%z_file:~0,-4%
if exist %z_file%.CBL goto file_ok
echo %0 ERROR: %z_file%.CBL was not found
set z_ReturnCode=16
goto return
call bat\fparts.bat %z_TraceMode% %z_file%
set z_file=%z_fdrv%%z_fpath%%z_fname%
if exist %z_file%%z_fext% goto file_ok
rem if extension specified: error because no default applies
if /I %z_fext%. NEQ . goto notfound
rem try with default extension of cbl
set z_fext=.cbl
Comment on lines +25 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 25-26. cbl should be CBL.

if exist %z_file%%z_fext% goto file_ok
:notfound
echo Error: Source file %z_file%%z_fext% does not exist
goto retry

:file_ok
if exist %z_file%.MLC erase %z_file%.MLC
Expand All @@ -44,7 +47,7 @@ rem get the z390 directory
set "z_HomeDir=%~dps0..\"
for %%f in ("%z_HomeDir%") do set "z_HomeDir=%%~ff"

call %~dps0ZC390 %z_TraceMode% %z_file% %2 %3 %4 %5 %6 %7 %8 %9
call %~dps0ZC390 %z_TraceMode% %z_file%%z_fext% %2 %3 %4 %5 %6 %7 %8 %9
set z_ReturnCode=%ERRORLEVEL%
rem any error or warning message has been issued by zc390
if %z_ReturnCode% NEQ 0 (if %z_ReturnCode% NEQ 4 (erase %z_file%.MLC
Expand All @@ -69,7 +72,9 @@ exit /b %z_ReturnCode%
echo .
echo the CBLCL.BAT procedure is intended to compile and link a single cobol program
echo .
set /P z_file=Hit Enter for more help or suppply name of cbl file to compile and link:
:retry
set z_file=
set /P z_file=Hit Enter for more help or supply name of cbl file to compile and link:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbl should be CBL.

if /I %z_file%. NEQ . goto chkfile

call %~dps0help %z_TraceMode%
Expand Down
Loading