Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
USS Shell script:Convert hex to binary save as jpg

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
RSR2015

New User


Joined: 02 Jul 2015
Posts: 1
Location: USA

PostPosted: Fri Sep 18, 2015 2:00 am    Post subject: USS Shell script:Convert hex to binary save as jpg
Reply with quote

Hello,
I am trying Unix scripts in zos for the first time. Here is a jist of what I am trying:
1. I have a file with multiple records which has the serialized image data in Hex format. It has two fields in the format:
TestInpfile.TXT
field1(image filename);field2(image data in hex)
for e.g "img1.jpg;FF45D..................
img2.jpg;F4D010................"
2. The existing java program currently
reads each record from input file,
convert data in field2 to bytes (HextoBinary),
writes it out to a file with filename as in field1 giving out the image files.
3. My requirement is to replace this java program with a shell script and execute it with BPXBATCH in JCL. (due to shop restrictions, not allowed to run the java program using BPXBATCH in JCL). Hence trying to jolt my own shell script to recreate the image files from the Hex dump like the java program.

I tried a simple script myself and was able to get the output files in Hex format.

Code:


#bin/sh
awk -F";" '{print $2 > $1}' TestInpfile.TXT


My questions are
1. Is it good to use the standard awk?
2. I tried to convert the string from hex to bin with the command
Code:
 'obase=16; ibase=2; $2 | bc'
but not able to pass this output to the awk command above.

If someone has experience in handling image files in USS through shell scripts, please guide me. I am stuck writing this unix shell script.
Back to top
View user's profile Send private message

View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert a JOBGROUP into an OPC (TWS/I... Steve Coalbran JCL & VSAM 0 Tue Sep 18, 2018 12:06 pm
This topic is locked: you cannot edit posts or make replies. Convert Julian to Gregorian zh_lad DFSORT/ICETOOL 21 Fri Jul 20, 2018 7:00 pm
No new posts Convert JCL to Unix Shell scripts mistah kurtz All Other Mainframe Topics 2 Sun Jul 01, 2018 7:21 pm
No new posts How to convert 2 bytes into single by... pkmurali DB2 6 Fri May 25, 2018 1:41 pm
No new posts How can I convert charactor to fixed ... liying DFSORT/ICETOOL 7 Tue May 22, 2018 3:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us