IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ASCII and EBCDIC conversion padded with '@'


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Thu Jan 24, 2013 11:04 pm
Reply with quote

Hello.

I am trying to convert ASCII to EBCDIC usiong following syntax:
OUTREC FIELDS=(1,nn,TRAN=ATOE)

But after conversion the o/p file is paddeed with '@' in place of space.

Input
Code:
ä?>ÈÁ>È.è`øÁ..Ñ_/ÅÁ.¦øÅ.


Output
Code:
Content-Type: image/jpg.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


Could you please suggest a best way to remove the padding'@' and keep it as space as it is.

Thank you.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jan 24, 2013 11:09 pm
Reply with quote

Hello,

Please post a bit of the problem data in Hex.

It looks like you may already have ebcdic data . . .
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Thu Jan 24, 2013 11:13 pm
Reply with quote

Please find the screenshot below in Hex

Input:

Code:
ä?>ÈÁ>È.è`øÁ..Ñ_/ÅÁ.¦øÅ.                                       
466766725776326666626760444444444444444444444444444444444444
3FE45E4D4905A09D175FA07A000000000000000000000000000000000000


Output:
Code:
Content-Type:    image/jpg.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
C99A89A6EA9874898886998277777777777777777777777777777777777
365355303875A09417511775CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jan 24, 2013 11:27 pm
Reply with quote

The "at" sign is X'40' ASCII and X'7C' in EBCDIC; the translation is working properly. Change the X'40' bytes in the input to X'20' (ASCII spaces, which will translate into EBCDIC spaces).
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Fri Jan 25, 2013 12:15 am
Reply with quote

Akatsukami wrote:
The "at" sign is X'40' ASCII and X'7C' in EBCDIC; the translation is working properly. Change the X'40' bytes in the input to X'20' (ASCII spaces, which will translate into EBCDIC spaces).



That worked. Thank you icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jan 25, 2013 12:59 am
Reply with quote

Hello,

You received a "mixed-bag" . . .

Suggest you work with whoever provided the data and have them use ascii spaces instead of the x'40's when creating the data.

Unless this was a one-time shot - then it won't matter icon_smile.gif
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Fri Jan 25, 2013 2:08 am
Reply with quote

dick scherrer wrote:
Hello,

You received a "mixed-bag" . . .

Suggest you work with whoever provided the data and have them use ascii spaces instead of the x'40's when creating the data.

Unless this was a one-time shot - then it won't matter icon_smile.gif


Thank you icon_smile.gif This would be a one time requirement and I was advised not to change anything in the input file.

The initial requirement was to do all three steps in one sort:

1. Convert VB to FB
2. TRAN=ATOE
3. Now that we have '@' in o/p, we need to change it back to space. Please note here that we first copied the VB to FB as a result space came in the file. But in the VB file there is no space after the data which means it looks like below:

Code:
    --------------------------------------------------
ä?>ÈÁ>È.èÊ/>ËÃÁÊ.á>Ä?ÀÑ>Å..Â/ËÁ...                   
4667667257667667246666666326676330                 
3FE45E4D421E3652D5E3F49E7A0213564A                 

The following sytax

Code:
SORT FIELDS=COPY                     
OUTFIL FNAMES=SORTOUT1,VTOF,         
INREC FINDREP=(INOUT=(X'40',X'20')) --> Now we dont have space after the data so I thing this wont be used 
OUTREC=(1:5,100,TRAN=ATOE)


Can it be done in one Sort step ?
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Fri Jan 25, 2013 2:38 am
Reply with quote

Niki wrote:
dick scherrer wrote:
Hello,

You received a "mixed-bag" . . .

Suggest you work with whoever provided the data and have them use ascii spaces instead of the x'40's when creating the data.

Unless this was a one-time shot - then it won't matter icon_smile.gif


Thank you icon_smile.gif This would be a one time requirement and I was advised not to change anything in the input file.

The initial requirement was to do all three steps in one sort:

1. Convert VB to FB
2. TRAN=ATOE
3. Now that we have '@' in o/p, we need to change it back to space. Please note here that we first copied the VB to FB as a result space came in the file. But in the VB file there is no space after the data which means it looks like below:

Code:
    --------------------------------------------------
ä?>ÈÁ>È.èÊ/>ËÃÁÊ.á>Ä?ÀÑ>Å..Â/ËÁ...                   
4667667257667667246666666326676330                 
3FE45E4D421E3652D5E3F49E7A0213564A                 

The following sytax

Code:
SORT FIELDS=COPY                     
OUTFIL FNAMES=SORTOUT1,VTOF,         
INREC FINDREP=(INOUT=(X'40',X'20')) --> Now we dont have space after the data so I thing this wont be used 
OUTREC=(1:5,100,TRAN=ATOE)


Can it be done in one Sort step ?



I am able to do it in two steps:

Step1:
Code:
SORT FIELDS=COPY             
OUTFIL FNAMES=SORTOUT1,VTOF,
OUTREC=(1:5,100,TRAN=ATOE) 


Step2:
Code:
SORT FIELDS=COPY                   
OUTREC FINDREP=(IN=(C'@'),OUT=C' ')


But the Step2 can also replace @ with space which may be incorrect for some record
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jan 25, 2013 3:47 am
Reply with quote

Niki,

You really don't need 2 steps to perform the conversion. Since your input file is VB you need not specify the length.

Use the following DFSORT JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DISP=SHR,DSN=Your Input VB ASCII file   
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  OPTION COPY                     
  INREC  BUILD=(1,4,5,TRAN=ATOE) 
  OUTFIL VTOF,BUILD=(5,100)       
//*
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Fri Jan 25, 2013 4:22 am
Reply with quote

Skolusu wrote:
Niki,

You really don't need 2 steps to perform the conversion. Since your input file is VB you need not specify the length.

Use the following DFSORT JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DISP=SHR,DSN=Your Input VB ASCII file   
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  OPTION COPY                     
  INREC  BUILD=(1,4,5,TRAN=ATOE) 
  OUTFIL VTOF,BUILD=(5,100)       
//*


Short and Sweet. Thank you so much Skolusu
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts SMF Record Date conversion failing CLIST & REXX 1
Search our Forums:

Back to Top