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

Upload and replace newline characters from data file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 12:22 am
Reply with quote

I know that the output dataset (after the conversion on the mainframe) is perfect because I used windows FTP to "get" the file from mainframe and the sequence is ok (0D 0A 0D 0A).
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: Wed Aug 29, 2007 1:11 am
Reply with quote

Hello,

Can you run the SELECT * query from a green-screen (3270) rather than a windows client?

Can you "unload" a few selected rows (ones with the embedded cr/lf) from teradata and see if the problem character is present?
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 1:19 am
Reply with quote

Hi, Dick...

Sorry, but I did not understand...

What do you mean by green-screen(3270)?

And what do you mean by "unload"? If you mean, exporting the data, I already did and, yes, the problem character is present...

It's driving me crazy...
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: Wed Aug 29, 2007 1:38 am
Reply with quote

Hi Rafael,

By green-screen, i mean a terminal that is used for TSO or CICS rather than a custom windows gui font-end application (in the "old days", the only device most people saw was a physical 3270 terminal which typically was a dark background with green characters). These days, a 3270 terminal emulator is how most people connect to the mainframe.

Whatever you use to connect to TSO or CICS should work as long as you can enter a query from that "terminal". Is there a way to run the SELECT query in batch and view the result in the output queue?

I suspect that my "unload" and your "export" are similar. Does teradata have the ability to export individual fields rather than whole rows/records?

Is there a way to hex-dump a row/record from teradata?

I'm trying to isloate when the "bad" character is introduced - during the load into teradata or just on the retrieval via the windows process.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 1:46 am
Reply with quote

Ok.. understood.

Yes... I can run the query via Rumba/TSO/ISPF which I use to access mainframe. I will do that and let you know...

About the column exporting, yes, I did export it and the D5s are really there.
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: Wed Aug 29, 2007 2:44 am
Reply with quote

Hi Rafael,

Sounds like the teradata load is adding the extra character when it encounters 2 sets of cr/lf - might even be a "feature"..

You might try to "edit" the file before running the load and replacing the cr/lf's with spaces.

For a simple test, you could use the tso/ispf editor. For longterm (if it works), you could replace them with yojr sort product.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 7:41 pm
Reply with quote

Good morning!

Dick,

I ran the SQL on the mainframe... The D5's are there...

Now I want to keep the cr/lfs... Even if I need to run an update in the database to eliminate the D5s... I don't want to do that though.. Very poor solution...

Any suggestions anyone?
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: Wed Aug 29, 2007 8:12 pm
Reply with quote

Hi Rafael,

You might try a modified version of my previous thought - edit the file replacing the 3-character cr/lf/N with cr/lf/space before loading. . . This would preserve the cr/lf but remove the unwanted N.

If that won't do what is needed let us know and we'll think some more icon_smile.gif
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 8:20 pm
Reply with quote

Hi, Dick...

Thanks for the support.. icon_biggrin.gif

I think you misunderstood.. in the file, before the loading, I have only CR/LF. The N, or Õ, appear only on the data stored in teradata.

Let me know if I was the one who misunderstood your suggestion...
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: Wed Aug 29, 2007 8:28 pm
Reply with quote

My bad icon_redface.gif Got ahead of myself.

Do you have teradata documentation? Is it possible that when cr/lf appears consecutively, the additional character is automatically inserted?

If you have support, you might open an issue with their support and see if this has happened to other teradata users.

If the data to be loaded has multiple consecutive sets of cr/lf, would changing the data to only contain 1 cr/lf work for your database data or are all of the cr/lf's needed?

Otherwise, your update within the database may be a way out.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 9:21 pm
Reply with quote

Dick,

I just looked closer in the dataset on mainframe (Found out how to check the hex dump without ftping the data set to windows.. icon_redface.gif ) and turns out that I did not describe this issue to you properly... icon_redface.gif icon_redface.gif

I am very very sorry for my mistake... Here is what really happens:

The original cr/lfs, which after the binary transfer and ebcdic conversion should be x'0d0a' in the converted dataset, are actually x'0d15'. Just to illustrate, look at the end of each record below:

Code:
    ..
444401
0000D5
-----
    ..
444401
0000D5
-----
    ..
444401
0000D5
-----
    ..
444401
0000D5
-----
    ..
444401
0000D5
-----


The same happens to cr/lfs in the middle of the records.

After I fastload this data to teradata, the all the x'15' are converted to x'D5'.

So, the actual problem is that, in the converted dataset, I have x'15' instead of all the x'0a'. And these are replaced with x'D5' after fastload.

This is the real picture. Sorry I misguided you before. I am learning to deal with things on mainframe as we work on this issue...

Anyway... I guess something went wrong on the conversion from binary to EBCDIC...

Any ideas on this new situation?
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 9:31 pm
Reply with quote

From IBM documentation:

Quote:
The NFS translation table OEMVS311 converts EBCDIC X’15’ (NL) to ASCII
X’0A’ (LF) and vice versa. But for a Windows workstation, you need to translate
NL to CRLF. There are several available workarounds to this problem.
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: Wed Aug 29, 2007 9:36 pm
Reply with quote

Not to worry icon_smile.gif

Sometimes it takes a while to sort thru icon_wink.gif

Can you move forward with the new understanding or might something still need attention?
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 9:43 pm
Reply with quote

Now, I am looking for a way to make these x'0d15' become x'0d0a'. If you have any info to guide me, please let me know.

Another thing to think about: Look at my previous post. The CRLFs at the end of each record after the OCOPY conversion are x'0d15'. Shouldn't they be x'15' considering that originally they were x'0d0a'?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Aug 29, 2007 10:40 pm
Reply with quote

Can't you just trim the last 2 bytes? They aren't really part of the data anyway.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Wed Aug 29, 2007 11:15 pm
Reply with quote

Hi, stodolas,

Sure can...

But I posted the last two bytes just to illustrate... The same thing happens with all CRLF in the record. And there are others in the middle (Without them, this topic wouldn`t even exist... icon_wink.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: Wed Aug 29, 2007 11:49 pm
Reply with quote

Hi Rafael,
Quote:
Another thing to think about: Look at my previous post. The CRLFs at the end of each record after the OCOPY conversion are x'0d15'. Shouldn't they be x'15' considering that originally they were x'0d0a'?
has me a bit confused. A bit of clarification might help.

If you have a mainframe file after the FTP and before the load that has x'0d15' or x'0d0a' the value can be changed by copying the file and replacing the "bad" value with whatever is needed.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Thu Aug 30, 2007 12:32 am
Reply with quote

Quote:
Another thing to think about: Look at my previous post. The CRLFs at the end of each record after the OCOPY conversion are x'0d15'. Shouldn't they be x'15' considering that originally they were x'0d0a'

Nevermind that... I misunderstood IBMs docs... It's doing exactly what it says... guess I need to rest my mind.. icon_redface.gif

But let me try to clarify my issue...

I will describe my whole process step by step with the product of each step...

Step 1: SQLServer extraction
Product "A": Ascii data file (line-breaks = x'0d0a')

Step 2: FTP "A" to mainframe as binary to avoid record-breaking
Product "B": Binary data set

Step 3: Conversion of "B" to EBCDIC through OCOPY
Product "C": EBCDIC data set (line-breaks = x'0d15')

Step 4: Fastload "C" into teradata
Product "D": Data loaded into database table (line-breaks = x'0dd5')

You see... the problem begins on step 3, where the x'0a' become x'15'. Then it is converted to x'd5' when fastloaded. I need it to be alway x'0a'. Is there a way to, on step 3, make the CRLF keep being x'0d0a' instead of being converted to x'0d15'?

If replacing it after step 3 is the answer... Which command should I use to perform this copy/replace?
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 Aug 30, 2007 12:57 am
Reply with quote

Hi Rafael,

Quote:
guess I need to rest my mind..
Yup, sometimes a good thing. . .

I believe you can get what you need in step3 but i am not familiar enough with OCOPY to say how. I suspect a custom translation would do it.

If that solution is not found, you should be able to get the x'15' to be x'0a' using your sort product. Is it true that all of the x'15's need to become x'0a'? Said a bit differently, could there be any valid x'15's in the data?

Which sort product is used on your system? If you are not sure, just run any sort and look at the sysout.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Thu Aug 30, 2007 2:39 am
Reply with quote

Guys,

One last thought before I go home and rest my mind... icon_wink.gif

What about specifying a custom translation table on the OCOPY step (instead of BPXFX311) that says "Wherever you find a x'0a' keep it as x'0a'!".

Is that possible?

I don't know how to create and specify a custom translation table... Can you guys show me how?

Talk to you guys in the morning...

Rafael
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 Aug 30, 2007 9:05 pm
Reply with quote

Hi Rafael,

Good morning icon_smile.gif

Good idea asking about the custom translation table in a new topic - i looked around some last night, but did not find anything useful.

If a custom translation table does not happen, you should be able to do what you need with your sort product. . .
Quote:
Which sort product is used on your system? If you are not sure, just run any sort and look at the sysout.
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Thu Aug 30, 2007 9:19 pm
Reply with quote

Thanks for all your time and help, Dick...

Once I find a solution, I shall get back to you on this...

Regards,
Rafael
Back to top
View user's profile Send private message
Rafael Longo

New User


Joined: 21 Jul 2007
Posts: 33
Location: Campinas, S?o Paulo, Brazil

PostPosted: Mon Sep 03, 2007 8:12 pm
Reply with quote

Hello,

Looks like EBCDIC's NL (0x15) do not have a ASCII equivalent. Teradata SQL Assistant client (which I run from windows) translates the 0x15 to 0xD5 (Don't ask me why this conversion was chosen).

So, the problem occurs only when I issue the query through windows. When I issue it from Mainframe (Green-screen, right Dick? icon_wink.gif ), I get the 0x15's back (I know I said that I got the D5's from mainframe too, but I did something wrong before...).

The thing is that I changed the "Session character set" from ASCII to UTF8 in the ODBC driver that Teradata SQL assistant uses to log and the the 0xD5's started to display correctly... as a Line wrapping.

So, it looks that the issue was just a diplaying problem on the particular client that I was using on windows...

And my problem is solved! The binary upload and conversion through OCOPY did it...

Thanks guys.
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: Mon Sep 03, 2007 10:59 pm
Reply with quote

Cool icon_wink.gif

Good to hear it is working.
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 -> JCL & VSAM Goto page Previous  1, 2, 3  Next

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top