csv 2 fixed with non consistant amount fileds



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: csv 2 fixed with non consistant amount fileds

Postby AKDEARAGON » Wed Oct 12, 2011 11:36 pm

I found my problem. This site has been great help glad I found it. :D


But could you explain a little more of what I'm using in the following area:
BUILD=(1:%00,7:%01,27:%02,29:%03,79:%04,85:%05,95:%06,
110:%07,145:%08,180:%09,215:%10,223:%11,253:%12,258:%13,
268:%14,269:%15,270:%16,272:%17,274:%18,275:%19,276:%20,
286:%21,296:%22,298:%23,308:%24,310:%25,311:%26,313:%27,
315:%28,316:%29,322:%30,328:%31,329:%32,330:%33,331:%34,
332:%35,333:%36,334:%37,335:%38,336:%39,337:%40,338:%41,
339:%42,340:%43,341:%44,351:%45,352:%46,353:%47,357:%48,
358:%49,359:%50,363:%51,367:%52,371:%53,372:%54,373:%55,
374:%56,375:%57,410:%58,411:%59)),
IFTHEN=(WHEN=INIT,
PARSE=(%60=(ABSPOS=316,ENDBEFR=C'.',ENDBEFR=C' ',FIXLEN=3),
%61=(FIXLEN=2),
%62=(ABSPOS=322,ENDBEFR=C'.',ENDBEFR=C' ',FIXLEN=3),
%63=(FIXLEN=2)),
OVERLAY=(316:%60,JFY=(SHIFT=RIGHT),C'.',%61,TRAN=ALTSEQ,
322:%62,JFY=(SHIFT=RIGHT),C'.',%63,TRAN=ALTSEQ))


The second ifthen that assigns %60 because I assume that %59 was last used from standard input, and ABSPOS=316 is absolute possition of the field I am using. I am getting 1st 3 postions up to the decimal if there is one or a ' ' showing end, then assigning %61 to last 2 char if there is value after decimal right. but then the overlay i'm little shake on when you use the tran=altseq that I really don't understand, but it works
AKDEARAGON
 
Posts: 13
Joined: Wed Oct 05, 2011 5:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: Re: csv 2 fixed with non consistant amount fileds

 

Re: csv 2 fixed with non consistant amount fileds

Postby Frank Yaeger » Wed Oct 12, 2011 11:57 pm

then the overlay i'm little shake on when you use the tran=altseq that I really don't understand, but it works


Again, break it down to understand it.

After:

OVERLAY=(316:%60,JFY=(SHIFT=RIGHT),C'.',%61,

we would have values like:

155.04
143. 
  2. 
154.84
166. 
  1.6
  1.06


The TRAN=ALTSEQ uses the ALTSEQ table (X'40' -> X'F0') to change the first and/or second blank after the decimal point to a zero.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: csv 2 fixed with non consistant amount fileds

Postby AKDEARAGON » Thu Oct 13, 2011 12:04 am

Thanks the light bulb has gone on!

New questions: if i have several fields in a row that I need to use this statement JFY=(SHIFT=RIGHT,LEAD=C'0') is there an easy way to group them save lines of code or just list out each field at a time? example:
BUILD=(1:%00,JFY=(SHIFT=RIGHT,LEAD=C'0'),
7:%01,27:%02,JFY=(SHIFT=RIGHT,LEAD=C'0'),
29:%03,79:%04,JFY=(SHIFT=RIGHT,LEAD=C'0'),
85:%05,JFY=(SHIFT=RIGHT,LEAD=C'0'),
95:%06,JFY=(SHIFT=RIGHT,LEAD=C'0'),

second question I have dates that appear as follows:
10/11/2011
5/15/2011
12/5/2011

I need them to end up as follows:
20111011
20110515
20111205
AKDEARAGON
 
Posts: 13
Joined: Wed Oct 05, 2011 5:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: csv 2 fixed with non consistant amount fileds

Postby Frank Yaeger » Thu Oct 13, 2011 1:10 am

If you need LEAD=C'0' for each individual field, you must specify them individually. If you grouped them together as one field, LEAD=C'0' would only apply to the one field, not the individual fields. Of course, I don't know why you are using LEAD=C'0' so I can't comment on whether you need it or not.

You can use a DFSORT job like the following to do your date conversion:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10/11/2011
5/15/2011
12/5/2011
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
               %02=(ENDBEFR=C'/',FIXLEN=2),
               %03=(FIXLEN=4)),
    BUILD=(%03,%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: csv 2 fixed with non consistant amount fileds

Postby AKDEARAGON » Thu Oct 13, 2011 1:24 am

Thanks for your help

All this is to get to the mainframe for processing.
AKDEARAGON
 
Posts: 13
Joined: Wed Oct 05, 2011 5:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: csv 2 fixed with non consistant amount fileds

Postby dick scherrer » Thu Oct 13, 2011 9:27 am

Hello,

All this is to get to the mainframe for processing.
How are these records to be used that requires this :?

If you explain howt these records are input, someone may have a suggestion as to how you can use the records directly.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: csv 2 fixed with non consistant amount fileds

Postby AKDEARAGON » Thu Oct 13, 2011 10:14 pm

This all goes to mainframe. The dates are compared for oldest or evaluated if greater than # of days. so need yyyymmdd include all zeroes. The numeric fields are evaluated for having numeric if then do something. if a numeric field has spaces before the number then to the mainframe it isn't numeric. if a field is 2 bytes long and it only has a blank then a 1 then it's not evaluated corectly but if it has 01 we are good to go.
AKDEARAGON
 
Posts: 13
Joined: Wed Oct 05, 2011 5:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: csv 2 fixed with non consistant amount fileds

Postby dick scherrer » Thu Oct 13, 2011 10:23 pm

Hello,

This all goes to mainframe
Does not answer my questoin.

The posted sort and whatever runs after is of course on the mainframe.

What program/utility reads the data after the sort (or without the sort if possible)?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: csv 2 fixed with non consistant amount fileds

Postby AKDEARAGON » Thu Oct 13, 2011 10:50 pm

Sorry, this all is used by cobol program and Easytrieve programs. I had coded a lengthy cobol job to parse it out and make each field usable going forward but now that I've done that I have gotten like 10 other request to do same sort of thing with other files of different lengths and values. I was trying to work this out thinking with dfsort it is faster to make changes and layout what file needs to be to the mainframe than coding new cobol job each time. It is clean and much faster.
%22=(ENDBEFR=C'/',FIXLEN=02),
%23=(ENDBEFR=C'/',FIXLEN=02),
%24=(ENDBEFR=X'05',FIXLEN=04),
%25=(ENDBEFR=C'/',FIXLEN=02),
%26=(ENDBEFR=C'/',FIXLEN=02),
%27=(ENDBEFR=X'05',FIXLEN=04),
I have new question testing my data.
if in the Parse area I have coded the date field to be 3 seperate fields example
and it is emediately followed by another date field but when i get to the build the first date field is empty I am not getting the expected results because I'm looking for c'/' it find the next delimiter of x'05' how can I build a blank or zero filed field for 1st date and then process the 2nd date?
AKDEARAGON
 
Posts: 13
Joined: Wed Oct 05, 2011 5:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: csv 2 fixed with non consistant amount fileds

Postby skolusu » Thu Oct 13, 2011 11:06 pm

Use the UFF on the year field like shown below

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
10/11/2011                                                         
5/15/2011                                                           
12/5/2011                                                           
                                                                   
NOVALUE                                                             
BLAHBLAH                                                           
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=02),                       
               %02=(ENDBEFR=C'/',FIXLEN=02),                       
               %03=(ENDBEFR=X'05',FIXLEN=04)),                     
    BUILD=(%03,UFF,EDIT=(TTTT),%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT))
//*


this produces
20111011
20110515
20111205
00000000
00000000
00000000
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

PreviousNext

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post