Giter Club home page Giter Club logo

ibmibashscripts's Introduction

ibmibashscripts

This repository will be a home for useful bash scripts on IBM i.

This is a learning experience so gentle feedback and your favorite IBM i bash examples would be nice to put here.

One thing you will notice is that I like verbose documentation :-)

Feel free to submit requests or input in the Issues section as well

ibmibashtemplate.sh

This bash script can serve as a good starter template for your bash scripts.

savlibifs.sh

Save IBM i Library to IFS based Save File

rstlibifs.sh

Restore IBM i Library from IFS based Save File

Editing IBM i Source Members using Visual Studio Code or other editors

IBM i developers who are using Visual Studio Code, Notepad++ and other PC based editors to edit source code can now more easily edit source members that originate from an IBM i source file. Library based source members can be quickly copied to an IFS file so they can be edited out of the IFS.

The cpysrctoifs.sh bash script can be used to quickly copy a library based source member to an IFS file where it can be directly edited with VS Code, etc. Simply change to the directory where the source member resides and run the script with the source member IFS file name.

Example to copy a source file member from QGPL/QCLSRC(SAMPLE), Type: CLP to relative IFS output path for editing

Sample bash/PASE command line sequence to copy from source file to IFS location:
cd /gitrepos/QGPL/QCLSRC
cpysrctoifs.sh SAMPLE.CLP

Note: Once your current directory is set to the appropriate directory in the terminal (via cd /dirpath)   
you don't need to use the cd operation again until you want to change to another source directory in the IFS.

โ— Make things even easier. Skip typing the .sh at runtime

First, create a symbolic link to cpysrctoifs.sh in /QOpenSys/pkgs/bin pointing to your script directory (mine is /ibmibashscripts): 
ln -s /ibmibashscripts/cpysrctoifs.sh /QOpenSys/pkgs/bin/cpysrctoifs

Sample bash/PASE command line sequence to copy from IFS location to source file:
cd /gitrepos/QGPL/QCLSRC
cpysrctoifs SAMPLE.CLP

The cpyifstosrc.sh bash command can be used to copy an IFS file edited by VS Code, etc back to a library based source member after editing. Simply change to the directory where the source member resides and run the script with the source member IFS file name.

Example to copy an IFS file named: /gitrepos/QGPL/QCLSRC/SAMPLE.CLP to source file member QGPL/QCLSRC(SAMPLE), Type: CLP to relative IFS output path for editing

Sample bash/PASE command line sequence to copy from IFS location to source file:
cd /gitrepos/QGPL/QCLSRC
cpyifstosrc.sh SAMPLE.CLP

Note: Once your current directory is set to the appropriate directory in the terminal (via cd /dirpath)   
you don't need to use the cd operation again until you want to change to another source directory in the IFS.

โ— Make things even easier. Skip typing the .sh at runtime

First, create a symbolic link to cpyifstosrc.sh in /QOpenSys/pkgs/bin pointing to your script directory (mine is /ibmibashscripts): 
ln -s /ibmibashscripts/cpyifstosrc.sh /QOpenSys/pkgs/bin/cpyifstosrc  

Sample bash/PASE command line sequence to copy from IFS location to source file:
cd /gitrepos/QGPL/QCLSRC
cpyifstosrc SAMPLE.CLP

cpysrctoifs.sh - Copy Source Member from Library to IFS File

Easily copy source member to IFS file path from library with minimal parameter entry for editing with Visual Studio Code, Notespad++ or other editors that can open and save IFS files.

P1 - Destination IFS file name (no dir path needed) entered in bash or other PASE shell. Source from library/file.member is automatically derived from the IFS directory path structure.
(Ex: /gitrepos/srclibrary/srcfile/srcmember.srctype = Source Library: srclibrary, Source File: srcfile, Source member: srcmember, Source type: srctype )
Note: The IFS directory used, does NOT have to be a Git repository unless you are using Git in the IFS.

P2-Optional - Replace destination IFS file. [Y/N] Default :Y

Example to copy a source file member from QGPL/QCLSRC(SAMPLE), Type: CLP to relative IFS output path for editing

Sample bash/PASE command line sequence to copy from source file to IFS location:
cd /gitrepos/QGPL/QCLSRC
cpysrctoifs.sh SAMPLE.CLP

Note: Once your current directory is set to the appropriate directory in the terminal (via cd /dirpath)   
you don't need to use the cd operation again until you want to change to another source directory in the IFS.

cpyifstosrc.sh - Copy IFS File to Source Member in Library

Easily copy IFS source member to source member in library with minimal parameter entry after editing with Visual Studio Code, Notepad++ or other editors that can open and save IFS file.

P1 - From IFS file name (no dir path needed) entered in bash or other PASE shell. Source from library/file.member is automatically derived from the IFS directory path structure.
(Ex: /gitrepos/srclibrary/srcfile/srcmember.srctype = Source Library: srclibrary, Source File: srcfile, Source member: srcmember, Source type: srctype )
Note: The IFS directory used, does NOT have to be a Git repository unless you are using Git in the IFS.

P2-Optional - Replace source member in library. [Y/N] Default :Y

Example to copy an IFS file named: /gitrepos/QGPL/QCLSRC/SAMPLE.CLP to source file member QGPL/QCLSRC(SAMPLE), Type: CLP to relative IFS output path for editing

Sample bash/PASE command line sequence to copy from IFS location to source file:
cd /gitrepos/QGPL/QCLSRC
cpyifstosrc.sh SAMPLE.CLP

Note: Once your current directory is set to the appropriate directory in the terminal (via cd /dirpath)   
you don't need to use the cd operation again until you want to change to another source directory in the IFS.

ibmibashscripts's People

Contributors

richardschoen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ibmibashscripts's Issues

additional scripts.

I found an IBM written script:
ftp://public.dhe.ibm.com/services/us/igsc/cs2/shellScripts/
the zips a save file.

I took the idea to then move a savf to ta real savf.
it needs some help but is functional. You can use if you want

#!/usr/bin/sh

declare SAVF=$1
declare -u LIBFILENAME=$2

echo $SAVF
echo $LIBFILENAME

declare -u IFSPATH="/QSYS.LIB/${LIBFILENAME%/}.LIB/${LIBFILENAME#/}.FILE"

echo $IFSPATH

system "crtsavf $LIBFILENAME"

echo '.:. Copying' $SAVF 'to save file' $LIBFILENAME '.:.'

sleep 1

cp $SAVF $IFSPATH

system "dspsavf $LIBFILENAME"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.