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

DFOSRT - Parse & Split the CSV file to multiple ouputs


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

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Mon Feb 09, 2009 9:10 am
Reply with quote

Hi,

My requirement is to parse & split the below input csv file (vb) by removing double quotes & comma and also each ouput file should have only detail records for current,MTD & YTD.


>>> Current-Date 20081130 TA <<< ** This is header record
"000000001203802","CXX HS EF 038C52464","988606108",0,0,
>>> Month-to-Date 20081031 TA <<< ** This is header record ***
"000000001103802","CYY HS AB 038C52464","304412209",0,0,
"000000001003802","CZZ HS CD 038C52464","65671D857",0,0,
>>> Year-to-Date 20081031 TA <<< ** This is header record
"000000001903802","DXY HS ZZ 038C52464","135671857",0,0,
"000000001503802","EXY HS YY 038C52464","25671D857",0,0,

I was able to parse the file & remove the double quotes. But could not split the file .
Any help is appreciated in this regard.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Feb 09, 2009 11:07 pm
Reply with quote

It's not clear what you want to do. I assume those are the input records you're showing. Please show the expected output file(s). Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file and output file(s).

Quote:
I was able to parse the file & remove the double quotes.


Show the job you used for that.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Tue Feb 10, 2009 12:35 am
Reply with quote

Hi Frank,

Your assumption is correct . what i had shown is the input file(lrecl=996, recfm=vb) which has 3 headers and corresponding detail records under each header. I am expecting 3 output files(lrecl=996,recfm=vb) as mentioned below from the input file

output1 - should contain the following from Today file
000000001203802 CXX HS EF 038C52464 988606108 0 0

output2 - should contain the following from Month-to-Date file
000000001103802 CYY HS AB 038C52464 304412209 0 0
000000001003802 CZZ HS CD 038C52464 65671D857 0 0

output3 - should contain the following from Year-to-date file
000000001903802 DXY HS ZZ 038C52464 135671857 0 0
000000001503802 EXY HS YY 038C52464 25671D857 0 0

So far i could code the following. But i want to split into 3 outputs

ALTSEQ CODE=(7F40)
INREC PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=17),
%02=(ENDBEFR=C',',FIXLEN=27),
%03=(ENDBEFR=C',',FIXLEN=11),
%04=(ENDBEFR=C',',FIXLEN=08),
%05=(ENDBEFR=C',',FIXLEN=05)),
BUILD=(1,4,
5:%01,
22:%02,
49:%03,
60:%04,
68:%05,
996:X)
SORT FIELDS=COPY
OUTREC OVERLAY=(5:5,996,TRAN=ALTSEQ)

Thanks in advance for your help
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 10, 2009 12:55 am
Reply with quote

FINDREP is a better choice for this then PARSE. Here's a DFSORT job that will do what you asked for. If you don't have PTF UK90013 (July, 2008) that supports FINDREP, ask your System Programmer to install it.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//OUT1 DD DSN=...   output file1 (VB)
//OUT2 DD DSN=...   output file2 (VB)
//OUT3 DD DSN=...   output file3 (VB)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
   IFTHEN=(WHEN=GROUP,
     BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
   IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    FINDREP=(INOUT=(C'"',C'',C',',C' ')))
  OUTFIL FNAMES=OUT1,
    INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
    BUILD=(1,4,6)
  OUTFIL FNAMES=OUT2,
    INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
    BUILD=(1,4,6)
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
/*
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Feb 11, 2009 12:16 am
Reply with quote

Dear Frank,

Thanks for your reply. It worked perfectly . But i have one more addition to it.Before i write the input records to the output, i would like to assign fixed lengths to some of the fields.
For example , i want field2 from input to be moved to 17 byte length
& field4 from input should be moved to 8 byte length .
Please let me know.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 11, 2009 12:29 am
Reply with quote

It isn't clear to me what you want. Please show the expected output records for your example input records. Use ubb code tags to show the output properly (or use b for each blank if you can't use ubb tags).
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Feb 11, 2009 1:31 am
Reply with quote

Dear Frank ,

For example, I am expecting the following output for the detail records under Month-to-date header in input file.
000000001103802 CYS HS AB 038C52464bbbbb 304412209 0bbbbbbb 0bbbb
000000001003802 CZZ HS CD 038C52464bbbbb 65671D857 0bbbbbbb 0bbbb

Please let me know if i am clear to you.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 11, 2009 2:48 am
Reply with quote

I still can't tell what your output record is supposed to look like exactly.

But it seems all you're trying to do is reformat the output records, so you just need to change the BUILD operand to do that, e,g,

Code:

  BUILD=(1,39,46:41,9,...) 
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Feb 11, 2009 3:18 am
Reply with quote

Dear Frank,

Thanks a lot. You are right i just wanted to reformat the output records after doing findrep & eliminating the header records.


Thanks
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Feb 11, 2009 3:39 am
Reply with quote

Dear Frank,

Sorry for not being clear what i wanted. Here is what i am looking for.

My input with recfm=vb & lrecl=996 looks like this

"000000001113802","Bank of America","088606108",0
"000000001103802","HSBC","204412209",0

and my output with recfm=vb & lrecl=996 should be as follows

<-15 bytes------->b<---25 bytes------>b<----9 bytes>b<--8bytes-->
000000001113802 Bank of Americabbb 088606108 0bbbbbbb
000000001103802 HSBCbbbbbbbbbbbb 204412209 0bbbbbb

Hope this time i am clear.


Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 11, 2009 4:32 am
Reply with quote

Here's a DFSORT job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//OUT1 DD DSN=...   output file1 (VB)
//OUT2 DD DSN=...   output file2 (VB)
//OUT3 DD DSN=...   output file3 (VB)
//SYSIN    DD    *
 OPTION COPY
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
  IFTHEN=(WHEN=GROUP,
    BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=16),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=10),
       %04=(FIXLEN=8)),
    BUILD=(1,5,%01,%02,%03,%04))
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
/*
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Thu Feb 12, 2009 10:38 pm
Reply with quote

Hi Frank,

Excellent !! . The solution worked fine
Appreciated for your effort & the time spent on my query.

Thanks
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 20, 2009 1:20 am
Reply with quote

Dear Frank,

I would like to convert one of the field to ZD before it is being written to output. I made some changes to the code provided by you . It is giving error. Could you please correct me?

Code:
//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//OUT1 DD DSN=...   output file1 (VB)
//OUT2 DD DSN=...   output file2 (VB)
//OUT3 DD DSN=...   output file3 (VB)
//SYSIN    DD    *
 OPTION COPY
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
  IFTHEN=(WHEN=GROUP,
    BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=16),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',SFF,TO=ZD,LENGTH=10), ===> Changed 
       %04=(FIXLEN=8)),
    BUILD=(1,5,%01,%02,%03,%04))
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 20, 2009 1:46 am
Reply with quote

Code:

      %03=(ENDBEFR=C',',SFF,TO=ZD,LENGTH=10), ===> Changed 


That's invalid syntax. You can't do the conversion while parsing. You need to do the conversion while building. The correct control statements would be:

Code:

 OPTION COPY
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
  IFTHEN=(WHEN=GROUP,
    BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=16),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=10),     <--- no change
       %04=(FIXLEN=8)),
    BUILD=(1,5,%01,%02,%03,SFF,TO=ZD,LENGTH=10,%04))  <--changed
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 20, 2009 2:25 am
Reply with quote

Frank,

Thanks for your quick response on this.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 1:36 am
Reply with quote

Dear Frank,

In the example below , i would like to have the sorted output files (vb) on the first 16 bytes. Sort statement has been included but it shows syntax error. Could you please let me know where i can include the sort statement to sort the output?

Code:
OPTION COPY
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
  IFTHEN=(WHEN=GROUP,
    BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=16),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=10),     
       %04=(FIXLEN=8)),
    BUILD=(1,5,%01,%02,%03,SFF,TO=ZD,LENGTH=10,%04)) 
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
   SORT FIELDS=(6,16,CH,A) ==> Added here
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
   SORT FIELDS=(6,16,CH,A) ==> Added here
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
   SORT FIELDS=(6,16,CH,A)  ==> Added here
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 27, 2009 2:01 am
Reply with quote

When I ran your job, the only message I got was:

ICE002I 0 DUPLICATE OR CONFLICTING SORT STATEMENT

That's not a syntax error - it's just a warning that you have multiple SORT statements.

You can only have one SORT statement and since you are sorting on the same keys for each of the OUTFIL data sets, you only need one SORT statement. However, you left in the OPTION COPY statement so you'll get a COPY rather than a SORT (COPY overrides SORT).

You can use these control statements. The records will be sorted on positions 6-21 of the reformatted INREC records - I assumed that's what you wanted, but I wasn't sure. (I put the SORT statement between the INREC statement and OUTFIL statements to correspond to the order in which the statements are processed - where you put the statements has no effect on that processing order).

Code:

 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
  IFTHEN=(WHEN=GROUP,
    BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
  IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=16),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=10),
       %04=(FIXLEN=8)),
    BUILD=(1,5,%01,%02,%03,SFF,TO=ZD,LENGTH=10,%04))
 SORT FIELDS=(6,16,CH,A)  ==> Added here
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT3,
   INCLUDE=(5,1,CH,EQ,C'3',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 3:09 am
Reply with quote

Dear Frank,

Thanks for your quick reply . But I am getting an error in the following sort control statements . Could you please identify the problem?

Code:
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
   IFTHEN=(WHEN=GROUP,
     BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
   IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
   IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=15),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=25),
       %04=(ENDBEFR=C',',FIXLEN=06),
       %05=(ENDBEFR=C',',FIXLEN=08),
       %06=(ENDBEFR=C',',FIXLEN=18),
       %07=(ENDBEFR=C',',FIXLEN=10),
       %08=(ENDBEFR=C',',FIXLEN=17),
       %09=(ENDBEFR=C',',FIXLEN=17),
       %10=(ENDBEFR=C',',FIXLEN=17),
       %11=(ENDBEFR=C',',FIXLEN=17),
       %12=(ENDBEFR=C',',FIXLEN=17),
       %13=(ENDBEFR=C',',FIXLEN=17),
       %14=(ENDBEFR=C',',FIXLEN=17),
       %15=(ENDBEFR=C',',FIXLEN=17),
    %16=(ENDBEFR=C',',FIXLEN=04),
    %17=(ENDBEFR=C',',FIXLEN=04),
    %18=(ENDBEFR=C',',FIXLEN=04),
    %19=(ENDBEFR=C',',FIXLEN=04)),
 BUILD=(1,5,
    6:%01,
   21:%02,
   47:%03,
   72:%04,
   78:%05,
   86:%06,SFF,TO=ZD,LENGTH=18,
  104:%07,
  114:%08,SFF,TO=ZD,LENGTH=17,
  131:%09,SFF,TO=ZD,LENGTH=17,
  148:%10,SFF,TO=ZD,LENGTH=17,
  165:%11,SFF,TO=ZD,LENGTH=17,
  182:%12,SFF,TO=ZD,LENGTH=17,
  199:%13,SFF,TO=ZD,LENGTH=17,
  216:%14,SFF,TO=ZD,LENGTH=17,
  233:%15,SFF,TO=ZD,LENGTH=17,
    250:%16,
    254:%17,
    258:%18,
    262:%19))
 SORT FIELDS=(6,15,CH,A,262,4,CH,A)
 OUTFIL FNAMES=OUT1,
   INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
   BUILD=(1,4,6)


Following are the statements shown after the job is run
Code:

ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
ICE750I 0 DC 27994 TC 0 CS DSVNN KSZ 23 VSZ 23
ICE752I 0 FSZ=27994 BC  IGN=0 E  AVG=501 0  WSP=35 C  DYN=2 56664
ICE218A 3 84 BYTE VARIABLE RECORD IS SHORTER THAN 261 BYTE MINIMUM FOR
ICE751I 1 D8-K24705 D4-K24705 E8-K90013
ICE052I 0 END OF DFSORT
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 3:29 am
Reply with quote

Dear Frank,

Please ignore the informational messages shown in my previous note .Consider the informational messages shown below
Code:
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
ICE750I 0 DC 27994 TC 0 CS DSVNN KSZ 23 VSZ 23
ICE752I 0 FSZ=27994 BC  IGN=0 E  AVG=501 0  WSP=35 C  DYN=2 56664
ICE218A 3 84 BYTE VARIABLE RECORD IS SHORTER THAN 265 BYTE MINIMUM FOR
ICE751I 1 D8-K24705 D4-K24705 E8-K90013
ICE052I 0 END OF DFSORT
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 27, 2009 3:32 am
Reply with quote

I don't see how you got that error message for that job. They don't match. Please check that.

If you are getting those error messages for that set of control statements, I'd need to see the source for your job and the complete set of JES messages, and DFSORT messages in //SYSOUT, for the run. Please send them to me offline (yaeger@us.ibm.com).
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 3:45 am
Reply with quote

Dear Frank,

I shall send the source of my job.But the same job works fine when i code only
Code:
SORT FIELDS=(6,15,CH,A)


Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 27, 2009 4:01 am
Reply with quote

The message indicates that you have a "short" record ... one that is shorter than the second SORT field you asked for. But the values shown in the message DO NOT match the fields shown in the SORT statement (they should match), and the use of the IFTHEN clauses would NOT allow that situation to be created. So I don't think what you've posted here is what you got that error message for (unless there's something else going on that you're not showing or aware of).

If you send me the source for the JOB and the complete set of JES and DFSORT messages, then I can probably figure out what's really going on.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 4:27 am
Reply with quote

Dear Frank,

I have sent a offline note with the job details to your IBM mail-id. Please look into it & let me know where exactly the problem is.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 27, 2009 4:39 am
Reply with quote

I received your messages offline.

I was looking at your original post that showed 261 in the ICE218A message and missed your correction to 265 in the ICE218A message. That makes more sense.

I guess you're only building certain records out to 265 bytes. It looks like the header records can end up being shorter than 265 bytes. So when you try to use a SORT field of 262,4,CH,A for one of these short records, you get the error message. The way to get around that normally is to use VLSHRT, but VLSHRT is being turned off because you're using INREC.

The solution would be to use two passes - one with INREC and the other with VLSHRT, SORT and OUTFIL like this.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=...  output file1
//OUT2 DD DSN=...  output file2
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SORT FROM(T1) USING(CTL2)
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
   IFTHEN=(WHEN=GROUP,
     BEGIN=(6,3,CH,EQ,C'>>>'),PUSH=(5:ID=1)),
   IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
    FINDREP=(INOUT=(C'"',C'')),HIT=NEXT),
   IFTHEN=(WHEN=(6,3,CH,NE,C'>>>'),
   PARSE=(%01=(ABSPOS=6,ENDBEFR=C',',FIXLEN=15),
       %02=(ENDBEFR=C',',FIXLEN=26),
       %03=(ENDBEFR=C',',FIXLEN=25),
       %04=(ENDBEFR=C',',FIXLEN=06),
       %05=(ENDBEFR=C',',FIXLEN=08),
       %06=(ENDBEFR=C',',FIXLEN=18),
       %07=(ENDBEFR=C',',FIXLEN=10),
       %08=(ENDBEFR=C',',FIXLEN=17),
       %09=(ENDBEFR=C',',FIXLEN=17),
       %10=(ENDBEFR=C',',FIXLEN=17),
       %11=(ENDBEFR=C',',FIXLEN=17),
       %12=(ENDBEFR=C',',FIXLEN=17),
       %13=(ENDBEFR=C',',FIXLEN=17),
       %14=(ENDBEFR=C',',FIXLEN=17),
       %15=(ENDBEFR=C',',FIXLEN=17),
    %16=(ENDBEFR=C',',FIXLEN=04),
    %17=(ENDBEFR=C',',FIXLEN=04),
    %18=(ENDBEFR=C',',FIXLEN=04),
    %19=(ENDBEFR=C',',FIXLEN=04)),
 BUILD=(1,5,
    6:%01,
   21:%02,
   47:%03,
   72:%04,
   78:%05,
   86:%06,SFF,TO=ZD,LENGTH=18,
  104:%07,
  114:%08,SFF,TO=ZD,LENGTH=17,
  131:%09,SFF,TO=ZD,LENGTH=17,
  148:%10,SFF,TO=ZD,LENGTH=17,
  165:%11,SFF,TO=ZD,LENGTH=17,
  182:%12,SFF,TO=ZD,LENGTH=17,
  199:%13,SFF,TO=ZD,LENGTH=17,
  216:%14,SFF,TO=ZD,LENGTH=17,
  233:%15,SFF,TO=ZD,LENGTH=17,
    250:%16,
    254:%17,
    258:%18,
    262:%19))
/*
//CTL2CNTL DD *
  OPTION VLSHRT
  SORT FIELDS=(6,15,CH,A,262,4,CH,A)
  OUTFIL FNAMES=OUT1,
    INCLUDE=(5,1,CH,EQ,C'1',AND,6,3,CH,NE,C'>>>'),
    BUILD=(1,4,6)
  OUTFIL FNAMES=OUT2,
    INCLUDE=(5,1,CH,EQ,C'2',AND,6,3,CH,NE,C'>>>'),
    BUILD=(1,4,6)
/*
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Fri Feb 27, 2009 6:09 am
Reply with quote

Dear Frank,

Thank you very much for your quick resolution on this.

Thanks
Suyerasi
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top