Facing Issue while sending a delimited mainfr file to CSV



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Facing Issue while sending a delimited mainfr file to CSV

Postby dkuma14 » Sat Oct 22, 2016 4:38 am

Hello everyone,

It will be great if anyone could suggest me on my below query.

I have a jcl which is sending a delimited (delimited by , ) mainframe PS file as .CSV in email.

What happening is one of the field of file is have , within it, so in excel it getting separated bcz it is treated as delimiter but actually it is not. I need whole record together
of that fields.

I have attached my delimited mainframe file and the screenshot of excel which actually I am getting and I have also attached what I am expecting, that screenshot will more clear it actually what my concern is.


Thanks for looking into this.
You do not have the required permissions to view the files attached to this post.
dkuma14
 
Posts: 15
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 7 times
Been thanked: 0 time

Re: Facing Issue while sending a delimited mainfr file to CSV

 

Re: Facing Issue while sending a delimited mainfr file to CS

Postby BillyBoyo » Sat Oct 22, 2016 4:41 am

You need to "protect" the field with a double-quote prior to the first character of the field and after the last

A,"1,234.00",B

That will only be three fields.

Note, you also need to protect the protector:

A,"XY"Z",B

Whatever reads the CSV will understand this, stripping the first and last ", and not using the comma or quote within such a field to mess things up.

These users thanked the author BillyBoyo for the post:
dkuma14 (Sat Oct 22, 2016 7:11 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 263 times

Re: Facing Issue while sending a delimited mainfr file to CS

Postby dkuma14 » Sat Oct 22, 2016 6:10 am

@Billy boyo .. Thanks for your suggetsion

I tried as you suggested but still I am not getting expected result.

Please look into the attachment.
You do not have the required permissions to view the files attached to this post.
dkuma14
 
Posts: 15
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 7 times
Been thanked: 0 time

Re: Facing Issue while sending a delimited mainfr file to CS

Postby Akatsukami » Sat Oct 22, 2016 6:37 am

Why do you not copy-and-paste from your terminal emulator instead wasting space with attachments?

Incidentally, you appear not to be using double-quotes, but two single-quotes (or pics).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1041
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 50 times

Re: Facing Issue while sending a delimited mainfr file to CS

Postby dkuma14 » Sat Oct 22, 2016 6:58 am

I tried with double quotes also (not two single quotes) still it is coming the same way.

And I tried to insert pic in content box (here) by clicking on Img, but when I click its come like this only . Neither I am able to copy paste my image here .

So I am giving it as an attachment.
dkuma14
 
Posts: 15
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 7 times
Been thanked: 0 time

Re: Facing Issue while sending a delimited mainfr file to CS

Postby NicC » Sat Oct 22, 2016 2:09 pm

Highlight the part of the screen you want to copy, press ctrl-c. Put the cursor in the text box of the reply page, press ctrl-v. Highlight the text that you have just pasted and click the Code button (if using the full editor which is available via the Post Reply button) or precede the text with [code ] and terminate it with [/code ] (no spaces between 'code' and ']'.

Also, this is not a JCL question but a question for whatever software (cobol pgm, sort utility) that you are using to create the dataset (not a 'file').
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2647
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 99 times

Re: Facing Issue while sending a delimited mainfr file to CS

Postby Aki88 » Sat Oct 22, 2016 5:34 pm

Hello,

Aside, positively There Is an error in the way the quotation (double-quotes) marks have been used to protect the data; you might want to revisit the same.

Here is a quick test run:

Unprotected data:


EDIT       XXXX.YYYY.ZZZZ                                 Columns 00001 00072
Command ===>                                                  Scroll ===> CSR  
****** ***************************** Top of Data ******************************
000001 THE,FIELDS,ARE,NOT,PROTECTED,HERE                                      
****** **************************** Bottom of Data ****************************
 


Gives:


THE FIELDS  ARE NOT PROTECTED   HERE  <-- the spaces are TABBED spaces from the converted .CSV file
 



Protected data:


EDIT       XXXX.YYYY.ZZZZ                                 Columns 00001 00072
Command ===>                                                  Scroll ===> CSR  
****** ***************************** Top of Data ******************************
000001 THE,FIELDS,"ARE,PROTECTED",HERE                                        
****** **************************** Bottom of Data ****************************


Gives:


THE FIELDS  ARE,PROTECTED   HERE  <-- Notice the TABBED spaces and the grouped words 'ARE,PROTECTED' here
 

These users thanked the author Aki88 for the post:
dkuma14 (Sat Oct 22, 2016 7:10 pm)
Aki88
 
Posts: 355
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 34 times

Re: Facing Issue while sending a delimited mainfr file to CS

Postby dkuma14 » Sat Oct 22, 2016 7:10 pm

Thanks everyone for your valuable time and help on this . It is working for me now.

Earlier I was doing same what you all have suggested but it was not working for me. So here I am writing the reason why it was not working earlier and now its worked for me. It might help someone.

Only difference was that ,earlier the field was having spaces after , before the field in which I want to use double quotes. Below is the sample for which it was not working.

***************************** Top of Data **********
 '033','80','00008',    "AK1,MA", EMI
 **************************** Bottom of Data *******


So if someone want to keep a field in double quote then starting double quote of that field should began just after the preceding , . Sample is given below which worked .
***************************** Top of Data **********
 '033','80','00008',"AK1,MA", EMI
 **************************** Bottom of Data *******


Note - If we are not using any double quotes for any fields then spaces between fields separated by comma is enough to get this result.
'033',    '80',       '00008',        AK1,     EMI


Here I have not used any double quotes so in this case spaces will not affect our result , is enough to keep fields in different column of the excel.


Again thanks to everyone for helping me.

You forgot to use the code tags. They should be used for everything that comes from your terminal. coded for you.
dkuma14
 
Posts: 15
Joined: Thu Oct 13, 2016 7:34 pm
Has thanked: 7 times
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post