Friday, October 22, 2021

Running GNU COBOL programs from a flash drive

 There are a few requirements to move your CYGWIN compiled COBOL programs to a flash drive for running on a different computer. Why would you want to do that? 

You may have a production machine the programs are targeted for that you do not want to include the source files.

The easiest way to get setup using a USB Drive is to have CYGWIN already installed on the machine and add the GNU Cobol DLL to the path.

Create a portable CYGWIN USB using these instructions for CygwinPortable.

https://github.com/GathSystems/CygwinPortable

2 Required Files to run GNU Cobol from a flash Drive can be found in these locations.

 cygwin1.dll (CYGWIN DLL)

Newer Installations Path:

D:\cygwin64\usr\i686-pc-cygwin\sys-root\usr\bin\cygwin1.dll

Older path:

E:\cygwin64\usr\i686-pc-cygwin\sys-root\usr\bin\cygwin1.dll

Newer Path:

E:\cygwin64\bin\cygwin1.dll

cygcob-4.dll (GNU COBOL DLL)

Packaged path:

gnu-cobol-2.0_nightly_r658.tar\gnu-cobol-2.0_nightly_r658\gnu-cobol-2.0\libcob\.libs\cygcob-4.dll

Installed Path:

E:\cygwin64\usr\local\bin\cygcob-4.dll

Once you have included the 2 DLL files with your program files you should be able to add the path to the targeted system and run your program.


Tuesday, November 17, 2020

Here are a few customizations to my CYGWIN GNU COBOL setup.

I have just finished a 4 year project and have slowed down to site maintenance for the moment at the University. Now it is time to start contributing to my Blog. Thank you for visiting my Blog. Here at the University of Tennesee we tend to brand everything we have. That being said I like to customize my environments that I use. There are many options in CYGWIN that many people may not know about.

Jay Summet has a great CYGWIN Install video check out this link:

https://www.youtube.com/watch?v=st8rjU0h0JM



First, I have a custom screen that comes up when I launch the CYGWIN console. The message is just a shell script that prints up the message for the user to see when the window is opened.

This is easily done by adding one line to the ‘.profile’ file in your home directory.

./message.sh

You can do a PWD after opening your CYGWIN console, or just type ‘echo $HOME’.

 So your $HOME will be ‘/home/{user name} ‘ but the real path in windows will be something like the following ‘C:\cygwin64\home\{user name}’.

The content for ‘message.sh’ is as follows:

#!/bin/bash

# This script clears the terminal, displays a greeting and gives information

# about currently connected users.  The two example variables are set and displayed.

clear # Clear the terminal window.

echo "                 * * * * * * * W A R N I N G * * * * * * * * * *"

echo " "

echo "This computer system is the property of the {organization name}. It is for  authorized use only. Unauthorized or improper use of this system may result in  administrative disciplinary action and/or civil charges/criminal penalties. By  continuing to use this system you indicate your awareness of and consent to     these terms and conditions of use."

echo " "

echo "LOG OFF IMMEDIATELY if you do not agree to conditions stated in this warning."

echo " "

echo "                 * * * * * * * * * * * * * * * * * * * * * * * * "

echo "Welcome, $USER" # dollar sign is used to get content of variable.

echo "Today's date is `date`, this is week `date +"%V"`."

echo "These users are currently connected:"

who | cut -d " " -f 1 - | grep -v USER | sort -u

echo " "

echo "This is `uname -s` running on a `uname -m` processor."

echo " "

#echo "This is the uptime information:"

#uptime

echo

 

The script also displays the User ID, time, date, and uptime.

I also have a menu that is custom made to run my favorite programs.

Menu content {menu.sh} is as follows:

#!/bin/bash

 

function press_enter

{

    echo ""

    echo -n "Press Enter to continue"

    read

    clear

}

 

function today {

    echo "Today's date is: "

    date +"%A, %B %-d, %Y"

}

 

 

selection=

until [ "$selection" = "0" ]; do

    clear

    echo ""

    echo "COMMAND LINE MENU"

    echo "    ---------------------------"

    echo "1   - display free disk space"

    echo "2   - display free memory"

    echo "3   - display current date"

    echo "4   - display processes"

    echo "5   - Shut Down SSH Service"

    echo "6   - Start Up  SSH Service"

    echo "7   - other programs"

    echo "8   - Phone Numbers"

    echo "8.5 - Do not select this!"

    echo "9   - Password Database"

    echo "    ----------------------------"

    echo "0   - exit menu"

    echo ""

    echo -n "Enter selection: "

    read selection

    echo ""

    case $selection in

        1 ) df ; press_enter ;;

        2 ) free ; press_enter ;;

        3 ) today ; press_enter ;;

                4 ) ps -ef; press_enter;;

                5 ) net stop sshd; press_enter;;

                6 ) net start sshd; press_enter;;

                7 ) games;;

        8 ) utkphonwin ;;

                8.5 ) phbook ;;

        9 ) COB_PRE_LOAD=cobdes utpasssecwin ;;

        0 ) exit ;;

        * ) echo "Please enter 1, 2, or 0"; press_enter

    esac

 

done

 

I would like to mention you can use the .profile to automatically launch the menu to create a ‘turn key’ system.

Thanks for visiting my Blog and I hope to have new content soon.



Friday, October 26, 2018

CYGWIN can be a powerful tool for the IT Professional.



Though it is not a full blown Linux system, the tools it adds to windows can be an asset for the IT Professional. When you install the tool within windows, you have options to install a variety of developer tools in the mix. My first exposure to the tool was when I took a C++ class at the University and the professor suggested that windows users install the tool on their personal machine. This in turn created a portable lab for getting our class work done. The University labs held Red Hat machines where you turned in your lab work. Ever since I have used CYGWIN in my work, mainly because many of our web servers are Red Hat Servers at the University.

When I install CYGWIN on a box I install all the packages, considering I never know what I may be working on. The web applications I support run on Microsoft Servers and open source Linux Servers. This is fairly common in Academia, as  most schools run on a tight budget.

What do I want to do with this blog? Well mainly I thought I would share some things I use in my job concerning this tool. One of the things I was going to cover was how to set up an SSH server on a IT Office machine. But with the latest changes to Windows 10, you can now install Open-ssh on Windows securely. Microsoft has gained an interest in the open source community, which I consider to be a good thing.

So what should I do? I think to start I have had an interest in Open COBOL for a while. I converted some old programs I had kept around from a previous employer a couple of years ago. These programs were Originally written in Microsoft COBOL in the 90s. There were only minor changes that needed to be made to the source before compiling in Open COBOL. While I have been using Open COBOL the name has changed to GNU COBOL. I encourage anyone interested in COBOL to give it a try as the project has proven to be very stable. I would dare say a person could create his own Green Screen system using the language. Two of the program I have created are a Password Database screen and a Phone Database screen. If time allows I plan to have a GIT HUB download of the source code I talk about in this blog.

If you followed me this far, I hope you are interested in reading more. Thanks for visiting my blog. I plan on the next post to be my initial set up for compiling GNU COBOL programs, and some minor changes to the CYGWIN environment that I like to use.