Thursday, 5 January 2023

Connect Direct

One point to note below is node_id is for the Unix/Linux server file irrespective of whether it is at source or destination, for Mainframe or windows it is s_node

#CD_PUT_WIN.TXT

&SUBPROC process s_node=&CONDIR #CONDIR = CONDIR_NAME # SUBPROC = SUBPROC_NAME

XFR01

copy from (file = &SRCFILE

node_id

)

ckpt = 2M

compress = extended

to (file = &OUTFILE

s_node

disp = rpl

)

pend

================================================

#CD_GET_MF.TXT

SUBPROC process s_node=ndm.ndm1 s_nodeid=(&MFUSERID,&MFPWD)

XFR01

copy from (file = &SRCFILE

s_node

)

ckpt = 2M

compress = extended

to (file = &OUTFILE

node_id

disp = rpl

)

pend

Unix/Linux Commands

These are some random Unix/Linux commands that we have come across and thought will be useful for tech enthusiasts,

#1 While writing a shell script if you would like to log the output of each and every command execution it is a good idea to have the script started with exec statement so that the total script output can be logged,

exec > /path/logfile.log 2>&1 

Here , File descriptor 1 is the standard output  

File descriptor 2 is the standard error

#2 typeset variable type

typeset is variable type that is used to hold a value pulled from a text file or a command output. Basically we are not pulling/assigning a value directly but it is being the result of a command or set of commands

For ex : Let's assume there is a txt file as below with three rows

check.txt 

----------------------------------

LX1 T LICENSE Test1

LX2 M LICENSE Test2

LX3 P LICENSE Test4

I would like to pull the 2nd and 4th column values from row 2 that has Test2 and then assign those values to col1 variable then here it is , 

typeset col1=`grep 'Test2' /check.txt | awk '{ print $2 , $4}'`

If the row has to be separated by field separator before printing the values then we use 'FS'

typeset col2=`grep 'Test2' /check.txt | awk 'BEGIN {FS = " "} { print $2 }'`

If at all we want a substring of a value

typeset col3=`grep 'Test2' /check.txt | awk '{ print substr($3, 3, 5) }'`

As per need the typeset variables can be echo'ed.

echo ++ col1 is ${col1}

Below is another way to use typeset variable,

typeset col4= `echo check.txt | awk 'BEGIN {FS = "/" } { print $4  }'`

#3 AWK commands

we have seen a couple awk commands in the above examples, here are some other,

date | awk ' BEGIN { print "Today date is " } OFS="/" {print $2,$3,$NF }'

who | awk '$1 == "owner" {print "Owner Name is " $1 , $2 }' 


#4 While loop

Using while loop to read lines of a file and apply various operations on them

Let's say there is a file with name check.txt

           IN_FILE=check.txt

while read LINE

do

    typeset CHECK_VAR=`echo ${LINE} | awk '{FS=","} {print            substr($1,1,4)}' `   #2016

    typeset CHECK_VAR_YEAR=`echo ${LINE} | awk '{FS=","} {print     substr($1,3,2)}' `

done < ${IN_FILE}

 

Essbase Certification Installation

 

Here are the steps to generate a certificate and install it with Essbase

Step 1: Stop Essbase

    Go to the Essbase bin path and execute stop.sh in most cases it is the below path

/essbase/config/essbase_domain/esstools/bin/stop.sh

Step 2 : Generate the certificate using openssl, here adserver will be your Active Directory server

openssl s_client -showcerts -connect adserver:port </dev/null     2>/dev/null|openssl x509 -outform PEM>/test/cert.pem

Step 3: If you think there is already an AD certificate in the java key store, take a backup of it 

cp /essbase/config/essbase_domain/config/fmwconfig/ovd/default/keystores/adapters.jks /../adapters.jks_$(date +%Y%m%d-%H%M%S)

Step 4: Now delete the certificate from keystore inorder not to add the same certificate again

 keytool -delete -alias adserver -keystore /../adapters.jks -storepass ${keystore_password} #keystore_password   

# Reference : https://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html

Step 5 : Now add the certificate to the java key store

keytool -import -noprompt -keystore /.../adapter.jks -alias adserver -file /.../cert.pem -storepass         ${keystore_password}

Step 6 : Verify the added certificate using key tool

keytool -list -v -keystore /.../adapters.jks

Step 7 : Start Essbase

essbase/config/essbase_domain/esstools/bin/start.sh

Connect Direct

One point to note below is node_id is for the Unix/Linux server file irrespective of whether it is at source or destination, for Mainframe o...