PASE, Shells, SSH , RUBY, Java, nodeJS, JSON/SQL
My systems:
dksrv104 - 7.1 empty T:
dksrv131 - 7.1 with PASE U:
dksrv206 - 6.1 Development P:
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
install PASE tools:
Using descripton from:
http://www.youngiprofessionals.com/
-> OS Binaries
Initial download made easy:
Open this file in winzip:
http://webfiles.icebreak.org/webfiles/PASE/download.zip
Extract to:
\\dksrv104\root\Qopensys
( my T: drive)
call qp2term (or ssh nli@dksrv104)
> cd /QOpenSys/download
> ./setup.sh
Now RPM and WGET is ready...
(RPM – Red hat Package Manager)
(WGET – WebGet)
Let try to install te ZIP tool
./wwwperzl.sh aix53 wget zip
./wwwperzl.sh aix53 rpm zip
Does is work?
zip test.zip /www/systest/*.*
From windows explorer:
T:\QOpenSys\download\test.zip
Get current version of ghost-script:
Which ghost is availabel?
./wwwperzl.sh aix53 list | grep -i ghost
What does that package require of packages?
./wwwperzl.sh aix53 wgetv ghostscript-9.06-2
Now !! go get it:
./wwwperzl.sh aix53 wget ghostscript-9.06-2
install it:
./wwwperzl.sh aix53 rpm ghostscript-9.06-2
Try it:
cd /ghost_samples
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16 -sOutputFile=./page%d.png -dFirstPage=1 -dLastPage=99 -q ./invoiceDemo.pdf
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16 -sOutputFile=./page%d.png -dFirstPage=1 -dLastPage=99 -q ./invoiceDemo2.pdf
Usecase on DKSRV206:
P:/ghost
What else in the box?
We can use the "normal" install – i rather use Perzl
./wwwinstall.sh --help
Samba server ...
http://www.ibm.com/developerworks/aix/library/au-aix_samba/
wwwperzl.sh aix53 list samba
wwwperzl.sh aix53 wget samba-3.6.22
wwwperzl.sh aix53 rpm samba-3.6.22
But now it is in 7.2 ( like OpenSsl) ... so
Say ”hello” using with diffrent opensource languages
GCC – Gnu C-compiler:
DKSRV131/home/nli/
gcc –o hello hello.c
hello
nodeJS:
node hello.js
PASE java:
javac Hello.java
java Hello
Shells:
-
IBMI OPM shell QCMD
-
IBMI ILE shell QSH
-
Bourne shell (sh) (qp2term)
-
C shell (csh)
-
TC shell (tcsh)
-
Korn shell (ksh)
-
Bourne Again SHell (bash)
What shells - ASCII or EBCDIC?
system "wrkactjob" | grep -i NLI
system "wrksplf" | grep RDY > spool.txt
list disk status:
db2 "select * from qsys2.SYSDISKS"
But only the 6B22 disk:
db2 "select * from qsys2.SYSDISKS" | grep -i 6B22
Prompt:
List all in user dir:
Ls –a /home/NLI .. finde the .profile
Edit the .profile and add:
PS1='$(pwd):'
SSH – Secure Shell:
Get stated:
http://www.ibm.com/developerworks/aix/library/au-sshsecurity/
Start the SSH deamon
STRTCPSVR SERVER(*SSHD)
Mount ssh drive on a mac
cd / volumes
mkdir dksrv131
sshfs dksrv131:/www dksrv131
.. Vis RPG7.1 i systest
Almindelig ssh
ssh
ls
which ls
ls -l /opensys/usr...
Open wrksplf output on mac with sublime edit using pipes |
ssh dksrv206 'system "wrksplf"' | subl
ssh dksrv206 'system "wrkactjob" | grep -i NLI' | subl
SSH and X11
X11 – applications setup
/QOpenSys/QIBM/ProdData/SC1/OpenSSH/openssh-4.7p1/etc/sshd_config
Set the foloowing:
X11Forwarding yes
X11UseLocalhost no
Open Ubunto terminal and do:
export DISPLAY=:0.0
ssh -X dksrv131
use Nirvana Edit - X11 application running on IBMI
nedit hello.c
RUBY:
On dksrv131
Get it:
http://powerruby.com/releases/power_ruby_current.zip
Intall it.
https://powerruby.worketc.com/kb?id=11
Setup:
https://powerruby.worketc.com/kb?id=22
Show until RAKE...
SQL-JSON
What is JSON:
items = [
{
"item": "iPhone",
"price" : 123.55 ,
"type" : "phone",
"Manufact":"APPLE",
"4Gsupprt":true,
"pixels":"5M",
"stock" : 9
},{
"item": "Ixus Plus",
"price" : 812.00 ,
"type" : "camera" ,
"Manufact" : "CANON" ,
"pixels" : "5M" ,
"stock" : 5
}
]
User Defined Table Functions – used in IceBreak
On DKSRV206 use QGPL/ITEMS ( a simple source file with the ”items”):
Select jsonGetStr(srcdta ,'item') as ItemName
from items
Cast the property
Select
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName
from items
Select
cast(jsonGetStr(srcdta ,'type') as char(10)) as Type,
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetStr(srcdta ,'pixels') as varchar(10)) as Pixels ,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price
from items
Adding the where
Select
cast(jsonGetStr(srcdta ,'type') as char(10)) as Type,
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetInt(srcdta ,'pixels') as int ) as Pixels,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price,
jsonGetInt(srcdta ,'stock') as Stock
from items
where jsonPropsIn (srcdta , 'type' , 'camera') = 1
Create is as a view
create view qtemp/camera as (
Select
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price,
cast(jsonGetInt(srcdta ,'pixels') as int ) as Pixels,
jsonGetInt(srcdta ,'stock') as Stock
from items
where jsonPropsIn (srcdta , 'type' , 'camera') = 1
)
Building up search
jsonPropsIn..
Select
cast(jsonGetStr(srcdta ,'type') as char(10)) as Type,
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetStr(srcdta ,'Manufact') as varchar(20)) as Manufact,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price
from items
where jsonPropsIn (srcdta , 'Manufact' , 'NIKON,APPLE') = 1
jsonPropsLike
Select
cast(jsonGetStr(srcdta ,'type') as char(10)) as Type,
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetStr(srcdta ,'Manufact') as varchar(20)) as Manufact,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price
from items
where jsonPropsLike (srcdta , 'item,Manufact' , 'canon') = 1
jsonPropsLikeIn
Select
cast(jsonGetStr(srcdta ,'type') as char(10)) as Type,
cast(jsonGetStr(srcdta ,'item') as varchar(30)) as ItemName,
cast(jsonGetStr(srcdta ,'Manufact') as varchar(20)) as Manufact,
cast(jsonGetNum(srcdta ,'price') as dec(7, 2)) as Price,
jsonGetInt(srcdta ,'stock') as Stock
from items
where jsonPropsLikeIn (srcdta , 'item,Manufact' , 'ix') = 1
update - set an object
update items
set srcdta = jsonSetObj(srcdta ,'p' , '{x:1,y:2}')
update - delete an object
update items
set srcdta = jsonSetObj(srcdta ,'p' , 'null')
update - set a string atribute
update items
set srcdta = jsonSetStr(srcdta ,'anystr' , 'Cool value')
Increment a numeric property
update items
set srcdta = jsonSetStr(srcdta, 'seq' ,
cast (jsonGetInt(srcdta, 'seq') + 1 as varchar(3))
)
Share with your friends: |