Page 1 of 1

FTP packed data

PostPosted: Fri Nov 21, 2014 8:58 pm
by k singh
Hi

I am pretty new to mainframe and please forgive me for asking stupid question.
I have dataset containing packed data( jumbled chars when viewed on its own). When i view it using a mapping file, I get the proper values in a formatted way. for ex.

dataset = xx.yy.zz
mapping file = dd.ff.gg

output

first name aaaaaaaaaa
middle name bbbbbbb
last name cccccccccc

i want to ftp this data to my local machine and compare it ftp'ed file from db2. i have done the db2 and comparing part but having problems while ftp from mainframe.
i have tried using xmlgen utility but to no good. please help me on this one as how to ftp the packed data in a formatted way.
thanks a lot

Re: FTP packed data

PostPosted: Fri Nov 21, 2014 10:27 pm
by Robert Sample
Your best approach is to use a program (SORT or one you write) to copy the data set, unpacking the packed decimal data to zoned decimal in the output data set. Data sets with packed decimal data must be transferred (via FTP, XMITIP, or whatever) as a BINARY file, which means your local system (Windows or Linux or whatever) must be able to handle EBCDIC data. Transferring packed decimal data as text will completely change the values and most likely make the data unusable.

Re: FTP packed data

PostPosted: Sat Nov 22, 2014 2:15 am
by k singh
thanks a lot Robert for your help. i had looked into dfsort utility as well. I believe below mentioned code will do the work.

OPTION COPY
INREC BUILD=(...,p,m,PD,TO=ZD,LENGTH=n,...)

but again as a newbie i am just confused as how to incorporate the mapping file in step.
I will keep on working on this one and keep posted on this one. thanks a lot

Re: FTP packed data

PostPosted: Sat Nov 22, 2014 12:32 pm
by Aki88
Hello K. Singh,

Here are a few posts which can help you with the problem:
This post poses a similar problem as yours.
This post has links to some really helpful DFSORT manuals shared by 'Frank'; you should be looking at 'DFSORT: Beyond Sorting' for quick tips; though a good place to start with DFSORT would still be 'z/OS DFSORT Application Programming Guide'
This post gives another approach for the same problem, converting packed data to zoned data.

If it still doesn't work, please post what you've tried along with sample input data and we'd be able to help you out.

Regards.

Re: FTP packed data

PostPosted: Tue Nov 25, 2014 1:27 am
by k singh
Thanks a lot guys. with your help and guidance I was successfully able to convert packed data into display using both xmlgen and dfsort. And then ftp output file to my local machine
Found xmlgen to be little easy but dfsort has lot of functionalities, ll try to learn them all.
now the next challenge. My data file has more than 150 columns but I need only few for my requirtement. I am looking into hide command to hide fields not required.
I don't want to manually hide columns in excel sheet. is any other way to select required fields automatically( like in sql we specify columns we need in select).
any guidance will be greatly appreciated.

Thanks and regards
k

Re: FTP packed data

PostPosted: Tue Nov 25, 2014 1:50 am
by k singh
code for xmlgen

SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//DD01 DD DSN=AAAAA.TEST.INPUT(Input),
// DISP=SHR
//DD01O DD DSN=aaaa.TEST.OUTPUT(output),
// DISP=OLD
//DD01RL DD DSN=aaaa.test.map(mapfile),
// DISP=SHR
//SYSIN DD *
$$DD01 XMLGEN INVALID=HEX,OUT=0

Re: FTP packed data

PostPosted: Tue Nov 25, 2014 4:30 pm
by NicC
Well, you could PARSE the records going into sort into the various fields and then BUILD output records with only the fields that you want. That is how I do it (although I was going from excel to m/f). I do not know how this fits with the rest of the solution.

Re: FTP packed data

PostPosted: Mon Dec 15, 2014 11:21 pm
by k singh
instead of parsing the records, I excluded the fields that I need , flip it and delete the rest that were not required. worked fine.
thanks and regards for the help