Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

Hexadecimal to decimal conversion - SORT JCL INREC OUTREC
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
jathampy
Member


Joined: 26 Sep 2009
Posts: 22
Location: software engineer

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Jan 15, 2010 6:25 pm    Post subject: Hexadecimal to decimal conversion - SORT JCL INREC OUTREC Reply with quote

Need a help in converting hexadecimal to decimal using SORT.
e.g 30E0 should be converted to 12512

I tried the following jcl but I am getting the output 4092642800 instead of 12512.

//STEP020 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
30E0
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,4,BI,ZDF)
//*
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

MrSpock
Active Member


Joined: 27 Jun 2007
Posts: 273

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
4 salutes

PostPosted: Fri Jan 15, 2010 7:06 pm    Post subject: Reply with quote

Hm. I get 12512 for my output.

'30E0'X is only two-bytes long, so I used

OUTREC FIELDS=(1,2,BI,ZDF)
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 975

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Jan 15, 2010 7:34 pm    Post subject: Reply with quote

jathampy,

//SORTIN DD *
30E0


would be treated as F3F0C5F0

you have to hex on your JOB JCL (since you have instream data) and as MrSpock said,
enter the 30E0 in two bytes.

Good Catch MrSpock!
_________________
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
5 votes
Not an useful post
Greate Post!! Salute Author
4 salutes

PostPosted: Fri Jan 15, 2010 9:26 pm    Post subject: Reply with quote

jathampy,

As Dick says, C'30E0' is X'F3F0C5F0', so you can't use BI,TO=ZDF to convert it. You have to do an actual conversion of the binary equivalent of the EBCDIC value.
Here's one way to do what you asked for with DFSORT:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
30E0
1234
5678
9ABC
DEF0
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(81:C'0',1,1,C'0',2,1,C'0',3,1,C'0',4,1)),
   IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,
    INOUT=(C'0A',C'10',C'0B',C'11',C'0C',C'12',
           C'0D',C'13',C'0E',C'14',C'0F',C'15'))),
   IFTHEN=(WHEN=INIT,
     BUILD=((81,2,ZD,MUL,+4096),ADD,
        (83,2,ZD,MUL,+256),ADD,
        (85,2,ZD,MUL,+16),ADD,(87,2,ZD),TO=ZDF,LENGTH=5))
/*


SORTOUT will have:

Code:

12512   
04660   
22136   
39612   
57072   

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
jathampy
Member


Joined: 26 Sep 2009
Posts: 22
Location: software engineer

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Fri Jan 15, 2010 10:32 pm    Post subject: Reply with quote

I tried the JCL provided by Frank and is working as per my expectation.

Thanks Frank for your timely help.

Also my special thanks to Mrspock and Dick
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
3 votes
Not an useful post
Greate Post!! Salute Author
6 salutes

PostPosted: Tue Oct 26, 2010 2:45 am    Post subject: Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can use DFSORT's new TRAN=UNHEX function to do this more easily like this:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
30E0
1234
5678
9ABC
DEF0
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(1,4,TRAN=UNHEX)
  OUTREC BUILD=(1,2,BI,TO=ZD)
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Oct 26, 2010 1:28 pm    Post subject: Reply with quote

Good One Frank...Smile
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
bharath.gct
Member


Joined: 31 Mar 2012
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Mar 31, 2012 8:22 am    Post subject: HEX to CHAR Representation Reply with quote

Hi Frank,

I only have SYNCSORT installed. Can we do this (TRAN=UNHEX) using ICETOOL?

Bharath
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
-2 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sun Apr 01, 2012 3:27 am    Post subject: Reply with quote

Frank is a DFSORT developer and does not support Syncsort.

Suggest you refer to the Syncsort documentation for your release of the product.

You might also open an issue with Syncsort support as they will be able to quickly tell you if your release supports this or if there is a workaround.
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Sun Apr 01, 2012 1:36 pm    Post subject: Reply with quote

SyncSort does not support UNHEX, at least till 1.3 release of it. However, you can use the sort-solution shown by Frank using IFTHEN with that release of SyncSort.

By the way, what release of SyncSort you are at?
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
bharath.gct
Member


Joined: 31 Mar 2012
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 02, 2012 5:57 am    Post subject: Reply with quote

Hi,

I did open this issue seperately in SyncSort Support Area. http://www.mainframegurukul.com/ibmmainframeforums/viewtopic.php?p=15557&highlight=#15557

I am using Syncsort V 1.3.02R. I guess mine did not support UNHEX. I tried running a example and it gave me a syntax error.

More details on i/p o/p can be found in the above link.

Thanks
Bharath
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
bharath.gct
Member


Joined: 31 Mar 2012
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Mon Apr 02, 2012 6:07 am    Post subject: Reply with quote

I did try Frank's IFTHEN solution using my SyncSort. Below is what I got:

Code:
SYNCSORT FOR Z/OS  1.3.0.2R

SYSIN :                                                   
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=INIT,                                 
    OVERLAY=(81:C'0',1,1,C'0',2,1,C'0',3,1,C'0',4,1)),     
   IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,                 
                     *                                     
    INOUT=(C'0A',C'10',C'0B',C'11',C'0C',C'12',           
           C'0D',C'13',C'0E',C'14',C'0F',C'15'))),         
   IFTHEN=(WHEN=INIT,                                     
     BUILD=((81,2,ZD,MUL,+4096),ADD,                       
        (83,2,ZD,MUL,+256),ADD,                           
        (85,2,ZD,MUL,+16),ADD,(87,2,ZD),TO=ZDF,LENGTH=5)) 
WER268A  INREC STATEMENT   : SYNTAX ERROR

_________________
Thanks
Bharath
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Mon Apr 02, 2012 9:15 pm    Post subject: Reply with quote

FINDREP is available with Syncsort 1.3.

There may be some examples of INREC / FINDREP in a previous topic. Make sure the topic is for Syncsort. . .

Suggest you look at the examples in the documentation for proper syntax and/or open an issue with Syncsort support.
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
sskum
Member


Joined: 17 Aug 2014
Posts: 1

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sun Aug 17, 2014 12:45 pm    Post subject: Reply with quote

Frank Yaeger wrote:
jathampy,

As Dick says, C'30E0' is X'F3F0C5F0', so you can't use BI,TO=ZDF to convert it. You have to do an actual conversion of the binary equivalent of the EBCDIC value.
Here's one way to do what you asked for with DFSORT:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
30E0
1234
5678
9ABC

DEF0
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(81:C'0',1,1,C'0',2,1,C'0',3,1,C'0',4,1)),
   IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,
    INOUT=(C'0A',C'10',C'0B',C'11',C'0C',C'12',
           C'0D',C'13',C'0E',C'14',C'0F',C'15'))),
   IFTHEN=(WHEN=INIT,
     BUILD=((81,2,ZD,MUL,+4096),ADD,
        (83,2,ZD,MUL,+256),ADD,
        (85,2,ZD,MUL,+16),ADD,(87,2,ZD),TO=ZDF,LENGTH=5))
/*


SORTOUT will have:

Code:

12512   
04660   
22136   
39612   
57072   



Hi Frank,

I tried your conversion and it worked very good.

The question is my input file has record till 35th position and in that 1-4 is hexadecimal that I need to convert. when I used the above sort card, 1-4 got converted and sortout has the decimal values in 1-4. but last 31 byte i.e., 05-35 is not appearing in output. the file is having 999 million records so I could nt download into excel and merge. Please let me know what should I use in the above sort card to copy 05-35 bytes as is.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
NicC
Active Member


Joined: 24 Jul 2011
Posts: 651
Location: Down on the pig farm

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sun Aug 17, 2014 2:07 pm    Post subject: Reply with quote

If you want to wait for Frank to reply then so be it - you will wait a very long time as he retired some time ago. Lesson to be learnt? Do not address posts to particular people.
Also, you should really have started a new topic as this one is old. You can link to this one or cut and paste the relevant bit.
_________________
Regards
Nic
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Getting no of records in a file 13 Rajapriyaa 14580 Wed Feb 03, 2016 12:44 am
academyindia4 View latest post
No new posts Replacing characters Using JCL 7 rachitsethcse 13827 Wed Feb 03, 2016 12:41 am
academyindia4 View latest post
No new posts Getting Error while using ICEMAN tool 6 giri211 13153 Wed Feb 03, 2016 12:40 am
academyindia4 View latest post
No new posts Calling COBOL from C - getting SOC1 2 balajiiinx 9049 Mon Feb 01, 2016 1:26 am
academyindia4 View latest post
No new posts Easytrieve program for getting Recound counts. 1 prakash.subramaniam 7197 Mon Oct 05, 2009 5:09 pm
Natarajan View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-4866.html