MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EBCDIC to ASCII Conversion
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Wed Jul 07, 2004 12:14 pm    Post subject: EBCDIC to ASCII Conversion Reply with quote

Hi,

Can anyone please help me with this ?

I have a file, it has EBCDIC and Binary Data in it.
I need to convert the EBCDIC data into ACSII format and Binary Data should not be effected.

Any help would be highly appreciated.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Jul 07, 2004 12:40 pm    Post subject: Reply with quote

Programmer1,

You could use DFSORT's TRAN=ALTSEQ feature and provide your own ALTSEQ table to do the EBCDIC to ASCII translation. There isn't a standard table for that. Code your own chart for the conversion. For example, for an input data set with RECFM=FB and LRECL=80, you could use:
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT    DD SYSOUT=*                                 
//SORTIN    DD DSN=YOUR INPUT EBCDIC DATASET,
//             DISP=SHR
//SORTOUT   DD DSN=YOUR OUTPUT ASCII DATASET,
//             DISP=(NEW,CATLG,DELETE),                 
//             UNIT=SYSDA,                               
//             SPACE=(CYL,(X,Y),RLSE)
//SYSIN     DD *                                       
  SORT FIELDS=COPY
  OUTREC FIELDS=(1,80,TABLE=ALTSEQ)
  ALTSEQ CODE=(...)
/*


Check this link for a detailed explanation of ALTSEQ

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/3.4?DT=20031124143823


Check this link for EBCDIC Chart and ASCII Chart

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Wed Jul 07, 2004 1:28 pm    Post subject: Reply with quote

Thanx Alot Kolusu,

I shall be trying this code tomorrow.

I hope we can omit the binary part of data by simply using the INREC fields ?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jul 07, 2004 2:11 pm    Post subject: Reply with quote

Quote:
I hope we can omit the binary part of data by simply using the INREC fields ?


Yes, you can specify DFSORT's p,m,TRAN=ALTSEQ for the fields you want to translate, and just specify p,m for the fields you don't want to translate.

You can use p,m,TRAN=ALTSEQ in the INREC or OUTREC statement, or in the OUTFIL OUTREC parameter.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Fri Jul 09, 2004 8:45 am    Post subject: Reply with quote

Thanx Frank.

Kolusu,

How do we specify the conversion table ?

Shall I simply copy a translation table into a flat file and then specify that flat file in ALTSEQ CODE=(...) as ALTSEQ CODE=(xxx.tran.table) ?

If this is not correct, please guide me with the correct way to do it.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jul 09, 2004 9:46 am    Post subject: Reply with quote

You code the translation table using the DFSORT ALTSEQ statement as follows:

Code:

   ALTSEQ CODE=(eeaa,eeaa,...)


where ee is the EBCDIC hex value (e.g. 40) and aa is the corresponding ASCII hex value (e.g. 20).

For complete information on DFSORT's ALTSEQ statement, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/3.4?DT=20031124143823

For a more detailed example, see the third bullet at:

http://www.storage.ibm.com/software/sort/mvs/beyond_sorting/online/srtmboft.html#oxl
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jul 20, 2004 11:39 am    Post subject: Reply with quote

Hi Kolusu / Frank

I tried running the JCL as below, it did not make any changes in the dataset. Can you please suggest the problem.
Code:

//STEP01  EXEC PGM=SORT
//SYSOUT  DD  SYSOUT=*
//SORTIN  DD  DSN=XXXX.TEST1.EBCDIC,DISP=SHR
//SORTOUT DD  DSN=XXXX.TEST1.ASCII,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            LIKE=XITS309.TEST1.EBCDIC
//SYSIN   DD *
  SORT FIELDS=COPY
  INREC FIELDS=(1,30,TRAN=ALTSEQ)
  ALTSEQ CODE=(150A,1C1C,1E1E)
/*

_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 20, 2004 1:42 pm    Post subject: Reply with quote

Why do you have 1C1C and 1E1E in your ALTSEQ statement? Those don't do anything. The idea of ALTSEQ is to change one character to another. 150A will change X'15' to X'0A'. If you have any X'15' characters in positions 1-30, they will be changed to X'0A' characters. If you didn't get any changes in the dataset, then you don't have any X'15' characters in positions 1-30 of any of your records. Use the appropriate from-to pairs in your ALTSEQ statements to do the changes you want.

If you want to see what's in positions 1-30 of your records in hex, you can use a DFSORT job like this:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...   input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,30,HEX)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Wed Jul 21, 2004 6:51 am    Post subject: Reply with quote

Thank You so very much Frank & Kolusu.

Frank, you are right, it was the data problem and now its going on smooth.

Thanx Again.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jul 21, 2004 10:18 am    Post subject: Reply with quote

Good. Thanks for the feedback.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Thu Jul 22, 2004 1:20 pm    Post subject: Reply with quote

Hi,

I have a question on this:

Is this method of translation an effective one ? We are handling massive files with record length of around 3000 bytes and with over 20,000 records.

Is there a better / more efficient method for this conversion ?

Will writing an Assembler routine help in this scenario ?

Can anyone please help me with this ?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Jul 22, 2004 1:56 pm    Post subject: Reply with quote

Quote:

Posted: Thu Jul 22, 2004 1:20 pm Post subject:

Hi,

I have a question on this:

Is this method of translation an effective one ? We are handling massive files with record length of around 3000 bytes and with over 20,000 records.

Is there a better / more efficient method for this conversion ?

Will writing an Assembler routine help in this scenario ?

Can anyone please help me with this

I wouldn't consider a mainframe file of 60MB as being particually massive. As far as available utilities for converting EBCDIC to ASCII that allow you to limit the conversion to certain fields, this is really the best solution.

Presumably, writing an optimized solution in assembler would PROBABLY be faster, but obvioulsy you would have to perform some benchmark tests to validate any perceived difference.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jul 22, 2004 2:46 pm    Post subject: Reply with quote

Programmer,

DFSORT is very efficient. Try it.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Thu Jul 22, 2004 2:56 pm    Post subject: Reply with quote

Frank,

Is this business Exclamation

Frank, I am very happy to use DFSORT because of its simplicity and flexibility. But some architects in my shop want me to get a better solution than this.

I understand that any subroutine (Assembler/ Cobol/ Rexx) would still convert the data byte by byte, in a very similar fasion as DFSORT would do.

Can you please suggest me if my understanding is correct ?

Is there a way, where in we can convert the data in a more efficient way, may be record by record or by using some faster accessible tables ?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jul 22, 2004 3:50 pm    Post subject: Reply with quote

Programmer,

I don't understand what you're asking.

I don't understand why your architects think DFSORT is less efficient than some undefined technique. DFSORT uses very optimized I/O and code paths and is very efficient for the copy application we're talking about here.

It's true that as a generalized utility, DFSORT incurs some overhead because it has to handle every possible situation. I imagine that a well-written program optimized to a specific situation could eliminate some of the generalized overhead DFSORT requires. Such a program could probably be more efficient than DFSORT for some small number of records. But unless that program also has very optimized I/O (EXCP access method), it will have a hard time beating DFSORT for a large number of records.

The only way to know for sure would be to write such a program and benchmark it against DFSORT.

BTW, DFSORT does not do the translation byte by byte - it's smarter than that.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group