Wednesday, April 27, 2022

Create a GIHUB Project Clone on your local machine using https

Some times you may want to download a copy of a github project to play around with the code. You may also be working on the project and need a fresh copy to make a change. Below are the commands to create a local copy of a project repo.

1) Make the project directory where you are going to work on the code.

2) Install GIT on your machine.

Command Prompt commands to use with in the project directory to create a fresh clone of our Repo on a new machine.

2) git init 


3) git remote add origin https://<user id you have on github>@github.com/<patch to project>


4) git config --global --add safe.directory <full project path>


5) git clone https://<user id you have on github>@github.com/<patch to project>

Example commands I used for a project:

git init

git remote add origin https://jfarrell423@github.utk.edu/oit/archibus_24.git


If you are not the author of the project you may need to execute this command below.

git config --global --add safe.directory E:/Work/archibus-dev


git clone https://jfarrell423@github.utk.edu/oit/archibus_24.git


Friday, March 25, 2022

Install CYGWIN and GNU COBOL

 First I downloaded the GYGWIN installed from the website.

https://cygwin.com/

For my purposes I installed every package available from the CYGWIN installer as I want as much functionality as I can get from my CYGWIN installation. But is you just want to install GNU COBOL here are the dependencies you need to install as of 12-29-2021. 

Watch my installation here: https://www.youtube.com/watch?v=vU0wpLtnMkY

I have time stamps for each the install steps. 

Current dependencies can be found here: https://sourceforge.net/projects/gnucobol/files/dependencies/

GnuCOBOL REQUIRES one of the following external libraries to be installed

for implementation of decimal arithmetic:


    BOTH runtime AND development components required.


  o GNU MP (libgmp) 4.1.2 or later

    https://gmplib.org


  OR


  o MPIR (libgmp - MPIR gmp-compat) 1.3.1 or later

    (preferred when compiling on Windows with other compilers than GCC)

    http://mpir.org


    GNU MP and MPIR are distributed under GNU Lesser General Public License.


    NOTE

    Please ALWAYS use the distro package whenever possible !!

    See NOTE above.



GnuCOBOL MAY require the following external libraries to be installed:


    ***

    NOTE - libltdl is NOT needed when installing on Linux,

    SUN Solaris, MAC OS, CentOS or Windows

        (including Cygwin, MingW and native windows).

    It is also NOT needed with later versions of AIX and HP-UX.

    (AIX >= 5.1 and HP-UX >= 11.1 are known to NOT require this).

    (Check if you have the "dlopen" function).

    ***


  o GNU Libtool (libltdl)

    https://www.gnu.org/software/libtool/libtool.html


    libltdl is used to implement dynamic CALL statements.


    GNU Libtool is distributed under GNU Lesser General Public License.



The following libraries ARE required WHEN :


1) Indexed-Sequential file I/O (ISAM) is used


    BOTH runtime AND development components required.


    One of the following:


  o Berkeley DB (libdb) 4.1 or later

    https://www.oracle.com/

    https://www.oracle.com/technology/products/berkeley-db/db/index.html


    Berkeley DB is distributed under Oracles own open-source license.

    Note that if you linked your software with Berkeley DB,

    you must distribute the source code of your software along with your

    software, or you have to pay royalty to Oracle.


  o VBISAM - ISAM file handler (libvbisam) 2.0 or later

    https://sourceforge.net/projects/vbisam/


    VBISAM is distributed under GNU Lesser General Public License.


  o DISAM File handler (libdisam)

    http://www.isamcentral.com


    DISAM is distributed under the proprietary License

    "Byte Designs Ltd. DISAM Software License".


2) SCREEN SECTION and/or extended ACCEPT/DISPLAY is used


    BOTH runtime AND development components required.


    One of the following:


  o Ncurses (ncurses or ncursesw) 5.2 or later

    https://www.gnu.org/software/ncurses/ncurses.html


    Ncurses is distributed under a BSD style license.


  o PDCurses (pdcurses) for MinGW/native windows ports

    https://pdcurses.org/ or https://github.com/Bill-Gray/PDCurses/


    PDCurses is distributed as Public Domain.


  o Unix curses


3) XML runtime support is used


    BOTH runtime AND development components required.


    libxml2 - http://xmlsoft.org


    libxml2 is distributed under MIT License.


4) JSON runtime support is used


    BOTH runtime AND development components required.


    One of the following:


  o cJSON >= 1.3.0 - https://github.com/DaveGamble/cJSON

    Note: As an alternative of an installed version you may place

    cJSON.c and cJSON.h under "libcob" to include the used functions

    directly in the COBOL runtime.


    cJSON is distributed under MIT License.


  o JSON-C >= 0.12 - https://github.com/json-c/json-c


    JSON-C is distributed under Expat License.

Create a installation directory:
I use C:\COBOL as my installation which is different from C:\OC as most people use.

After CYGWIN is installed you may want to edit C:\cygwin\home\<xyz>\.bashrc

Comment out these lines in the file

# export HISTCONTROL=ignoredups

...   .

# alias rm='rm -i'

# alias cp='cp -i'

# alias mv='mv -i'

     ...

#alias less='less -r'        # raw control characters

# alias whence='type -a'     # where, of a sort

# alias grep='grep --color'                    

     ...

# alias ls='ls -hF --color=tty'  # classify files in colour

# alias dir='ls --color=auto --format=vertical'

# alias vdir='ls --color=auto --format=long'

# alias ll='ls -l'                              # long list

# alias la='ls -A'                              # all but . and ..

# alias l='ls -CF'                             


Add these lines to the end of the file


# some additional commands to enter

alias c:='cd /cygdrive/c'

alias grep='grep --color'

alias cls='clear'

alias lla='ls -la'

alias d2u='dos2unix'

 

# only add the following if you have your programs

#   in c:/OC/pgms

alias mypgms='cd /cygdrive/c/OC/pgms'

 

# set a nice looking prompt:

PS1='\h:\W\$ '



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.