Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Conversion of EBCDIC to ASCII

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
bonda0123

New User


Joined: 07 Sep 2007
Posts: 9
Location: Hyderabad

PostPosted: Tue Sep 25, 2007 12:51 pm    Post subject: Conversion of EBCDIC to ASCII
Reply with quote

I need a help for the conversion from EBCDIC to ASCII. Can anyone help me with the JCL utility or the JCL which helps us in this conversion.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 25, 2007 8:46 pm    Post subject:
Reply with quote

Hello,

Are you working between platforms (i.e mainframe and win-based/unix)?

Nearly always ascii/ebcdic translation is done as part of a file transfer.

If you explain more about what you need to do, we may have better suggestions.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Sep 25, 2007 9:42 pm    Post subject: Reply to: Conversion of EBCDIC to ASCII
Reply with quote

EBCDIC to ASCII. Three methods that I know of:

Code:

//STEPXXX  EXEC PGM=IKJEFT01                                       
//SYSTERM  DD   DUMMY                                               
//INPUT    DD   DSN=FB.dataset.EBC,DISP=SHR             
//OUTPUT   DD   DSN=FB.dataset.ASC,                     
//         DISP=(,CATLG,DELETE),...                                     
//SYSTSIN  DD   DATA                                               
OCOPY INDD(input) OUTDD(output) TEXT CONVERT((BPXFX311)) FROM1047   
/*                                                                 


Code:

//STEPXXX  EXEC SAS
//INPUT    DD   DSN=FB.dataset.EBC,DISP=SHR             
//OUTPUT   DD   DSN=FB.dataset.ASC,                     
//         DISP=(,CATLG,DELETE),... 
//SYSIN    DD   *                                                       
DATA _NULL_;                         
INFILE INPUT;                       
FILE OUTPUT;                         
INPUT @1 LINE1 $CHAR80.;             
PUT @1 LINE1 $ASCII80.;             
/*


Code:

/* REXX E2A                                                          */
/* INPUT VARIABLES:                                                  */
/* DLM  = ASCII RECORD DELIMITER. NO DEFAULT. NORMALLY SET TO        */
/*        CRLF (CARRIAGE RETURN/LINE FEED) FOR WINDOWS, OR           */
/*        LF (LINE FEED ONLY) FOR UNIX SYSTEMS.                      */
/* TERM = ASCII END-OF-FILE TERMINATOR. NO DEFAULT. NORMALLY SET TO  */
/*        CZ (CONTROL-Z) FOR DOS OR WINDOWS.                         */
/* ***************************************************************** */
/* INPUT FILES:                                                      */
/* SYSUT1 = INPUT EBCDIC DATASET TO BE CONVERTED. MAY BE EITHER      */
/*          FB OR VB.                                                */
/* SYSUT2 = OUTPUT ASCII DATASET. RECOMMENDED TO BE VB.              */
/* ***************************************************************** */
PARSE UPPER ARG DLM TERM .                                   
SELECT                                                       
  WHEN DLM = "CR"   THEN REC_DLM = '0D'X                     
  WHEN DLM = "LF"   THEN REC_DLM = '0A'X                     
  WHEN DLM = "CRLF" THEN REC_DLM = '0D0A'X                   
  WHEN DLM = "LFCR" THEN REC_DLM = '0A0D'X                   
  OTHERWISE REC_DLM = ""                                     
END                                                           
SELECT                                                       
  WHEN TERM = "CZ"  THEN REC_TERM = '1A'X                     
  OTHERWISE REC_TERM = ""                                     
END                                                           
DO FOREVER                                                   
  "EXECIO 1 DISKR SYSUT1"                                     
  IF RC <> 0 THEN LEAVE                                       
  PARSE PULL EBC_REC                                         
  ASC_REC = ""                                               
  DO LOOP = 1 TO LENGTH(STRIP(EBC_REC,T," "))                 
    CHR = SUBSTR(EBC_REC,LOOP,1)                             
    CHR = E2A(CHR)                                           
    ASC_REC = ASC_REC||CHR                                           
  END                                                                 
  ASC_REC = ASC_REC||REC_DLM                                         
  PUSH ASC_REC                                                       
  "EXECIO 1 DISKW SYSUT2"                                             
END                                                                   
IF LENGTH(REC_TERM) > 0 THEN                                         
  DO                                                                 
    PUSH REC_TERM                                                     
    "EXECIO 1 DISKW SYSUT2"                                           
  END                                                                 
"EXECIO 0 DISKR SYSUT1 (FINIS"                                       
"EXECIO 0 DISKW SYSUT2 (FINIS"                                       
EXIT 0                                                               
                                                                     
E2A:                                                                 
RETURN TRANSLATE(ARG(1), ,                                           
                 '00 01 02 03 9C 09 86 7F 97 8D 8E 0B 0C 0D 0E 0F'X||,
                 '10 11 12 13 9D 85 08 87 18 19 92 8F 1C 1D 1E 1F'X||,
                 '80 81 82 83 84 0A 17 1B 88 89 8A 8B 8C 05 06 07'X||,
                 '90 91 16 93 94 95 96 04 98 99 9A 9B 14 15 9E 1A'X||,
                 '20 A0 A1 A2 A3 A4 A5 A6 A7 A8 5B 2E 3C 28 2B 21'X||,
                 '26 A9 AA AB AC AD AE AF B0 B1 5D 24 2A 29 3B 5E'X||,
                 '2D 2F B2 B3 B4 B5 B6 B7 B8 B9 7C 2C 25 5F 3E 3F'X||,
                 'BA BB BC BD BE BF C0 C1 C2 60 3A 23 40 27 3D 22'X||,
                 'C3 61 62 63 64 65 66 67 68 69 C4 C5 C6 C7 C8 C9'X||,
                 'CA 6A 6B 6C 6D 6E 6F 70 71 72 CB CC CD CE CF D0'X||,
                 'D1 7E 73 74 75 76 77 78 79 7A D2 D3 D4 D5 D6 D7'X||,
                 'D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7'X||,
                 '7B 41 42 43 44 45 46 47 48 49 E8 E9 EA EB EC ED'X||,
                 '7D 4A 4B 4C 4D 4E 4F 50 51 52 EE EF F0 F1 F2 F3'X||,
                 '5C 9F 53 54 55 56 57 58 59 5A F4 F5 F6 F7 F8 F9'X||,
                 '30 31 32 33 34 35 36 37 38 39 FA FB FC FD FE FF'X) 
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Sep 25, 2007 9:45 pm    Post subject: Reply to: Conversion of EBCDIC to ASCII
Reply with quote

... plus this previous topic ...

http://www.ibmmainframes.com/viewtopic.php?t=3963
Back to top
View user's profile Send private message
bonda0123

New User


Joined: 07 Sep 2007
Posts: 9
Location: Hyderabad

PostPosted: Wed Sep 26, 2007 11:18 am    Post subject: Thanks a lot!!!
Reply with quote

Hi Dick scherrer and superk, Thanks a Lot for the immediate response.

I got a cobol code for doing this transaction :

COBOL CODE :
Code:

Code removed due to copyright

And the JCL to be run with the code will be :
JCL



Thanks a Lot once again to both of you for the immediate response.






icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Sep 26, 2007 9:59 pm    Post subject:
Reply with quote

You're welcome icon_smile.gif

After the conversion, how will the ascii file be used on the mainframe?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 27, 2007 1:51 am    Post subject: Reply to: Conversion of EBCDIC to ASCII
Reply with quote

Hello,

It has been brought to my attention that the code you posted is copyright material. Removing the copyright notice does not remove the copyright.

Do not post anything that is copyright in the forums.

I have removed the code.
Back to top
View user's profile Send private message
bonda0123

New User


Joined: 07 Sep 2007
Posts: 9
Location: Hyderabad

PostPosted: Thu Sep 27, 2007 11:06 am    Post subject: Reply to: Conversion of EBCDIC to ASCII
Reply with quote

Thanks a Lot for letting me know this Scherer...yes as you said that is a copyright material got from some website search....But can you please let me know the way we can find out whether its a copyright material or not..So that I will take decision in future...

Thanks a Lot again for letting me know this!!! icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Sep 27, 2007 12:03 pm    Post subject: Reply to: Conversion of EBCDIC to ASCII
Reply with quote

The task of converting from EBCDIC to ASCII and the reverse are not that simple...
Depending on the application and it's portability You need to take into account also the codepage

a google search on :
Quote:
cobol ebcdic ascii conversion codepage

will give You many documents to meditate on!

I would check also the capabilities of enterprise cobol
as far as unicode and ebcdic ascii support
http://www-1.ibm.com/support/docview.wss?rs=0&q=locale&uid=swg27004197&loc=en_US&cs=utf-8&cc=us&lang=en

regards

e.s
Back to top
View user's profile Send private message
bonda0123

New User


Joined: 07 Sep 2007
Posts: 9
Location: Hyderabad

PostPosted: Fri Oct 05, 2007 9:50 pm    Post subject: Thanks a Lot Enrico!!!
Reply with quote

Sorry was away from my laptop from past few dayz. i will check those documents and will let you know if I have any clarifications.

Thanks a Lot Enrico once again for giving me this further info..!!!
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm
No new posts Comparex utility to Syncsort conversion mistah kurtz SYNCSORT 11 Fri Jul 22, 2016 1:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us