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

Grouping and editing using DFSORT


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

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Mon Feb 19, 2007 11:02 am
Reply with quote

Hi,

I have a file(FBA 133) that looks like this.

Code:
DATA aaaa.aaaaa.aaaa.aaaa
     TYPE=x1
           NUM=bbbb.bbbb
DATA aaaa.aaaaa.aaaa.bbbb
     TYPE=x2
           NUM=bbbb.cccc


I want the output to look like

Code:
aaaa.aaaa.aaaa.aaaa x1 bbbb.bbbb
aaaa.aaaa.aaaa.bbbb x2 bbbb.cccc


Basically, it groups three rows into 1 row and does some editing like removing 'data/type/num' from the output.

thanks for any 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: Mon Feb 19, 2007 9:30 pm
Reply with quote

Am I correct that 'DATA' starts in position 2 (after the ANSI carriage control character), 'TYPE' starts in position 7 and NUM starts in position 13?

What do you want for the RECFM and LRECL of the output file?
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Mon Feb 19, 2007 10:43 pm
Reply with quote

Frank,

Yes, DATA starts in position 2(after ANSI CC caracter). And TYPE, NUM start at 7 and 13 respectively.

LRECL of 80 and RECFM of FB would be great.

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

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Mon Feb 19, 2007 11:27 pm
Reply with quote

Frank,

The input file is actually VBA with LRECL 133
Sorry for the confusion.

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

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Tue Feb 20, 2007 1:12 am
Reply with quote

You could use the below ICETOOL job to sort the records,

[img]//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFILE DD DSN=INPUT FILE 1(VBA File/133)
//TEMP DD DSN = TEMP FILE(FB file/80)
//OUTF DD DSN = OUT FILE 1(FB file/80)
//TOOLIN DD *
COPY FROM INFILE USING CTL1
SPLICE FROM TEMP ON (34,8,ZD) WITHEACH USING CTL2
//CTL1CNTL DD *
*Reformat the records and add sequence numbers
OUTFIL FNAMES=TEMP,
IFTHEN=(WHEN=(6,4,CH,EQ,C'DATA'), BUILD =(1:11,19,34:SEQNUM,8,ZD))
IFTHEN=(WHEN=(10,5,CH,EQ,C'TYPE='), BUILD =(21:15,2,34:SEQNUM,8,ZD))
IFTHEN=(WHEN=(16,4,CH,EQ,C'NUM='), BUILD =(24:20,9,34:SEQNUM,8,ZD))
/*
//CTL2CNTL DD *
OUTFIL FNAMES = OUTF, BUILD = (1,32)
/*[/img]

Quote:

DATA aaaa.aaaaa.aaaa.aaaa
DATA aaaa.aaaaa.aaaa.bbbb


I assumed that the "aaaaa" after the first dot is mistaken for "aaaa".

Dinesh.
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Tue Feb 20, 2007 2:01 am
Reply with quote

Dinesh,

yes, 'aaaaa' was a typo.

I get a SYNTAX error with '$' under IFTHEN and BUILD. I suppose I don't have the appropriate PTFs installed. And so out of luck!

Thanks anyway for your effort.
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 20, 2007 2:07 am
Reply with quote

wanderer,

Dinesh had the right idea, but the job he supplied has many errors and won't run. Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (VBA)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(41,8,ZD) -
  WITHEACH WITH(26,2) WITH(29,9) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(6,4,CH,EQ,C'DATA'),
     BUILD=(1:1,4,5:11,20,41:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(11,5,CH,EQ,C'TYPE='),
     BUILD=(1,4,26:16,2,41:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(17,4,CH,EQ,C'NUM='),
     BUILD=(1,4,29:21,9,41:SEQNUM,8,ZD))
   OUTFIL FNAMES=OUT,VTOF,
     BUILD=(5,33,80:X)
/*
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Tue Feb 20, 2007 3:25 am
Reply with quote

Frank,

I keep getting
ICE005A 0 STATEMENT DEFINER ERROR

for IFTHEN and BUILD. I suppose I don't have proper PTF installed and out of luck!

Thanks for the 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 20, 2007 3:55 am
Reply with quote

Do you have at least one space before each line in CTL1CNTL? If not, add the spaces. If you get the ICE005A with the spaces, then your site is way behind on DFSORT service; IFTHEN and BUILD have been available since Dec, 2004. Ask your System Programmer to z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006). That will get you all of the latest DFSORT/ICETOOL functions.
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Tue Feb 20, 2007 6:09 am
Reply with quote

Frank,

No I did not have one space on one line. Now it is working fine. Thanks very much!

I have another problem though. Sometimes the file contains other records in the file that are smaller than these records. I need to ignore these extra records if they come in between.

For example,
There is a record with just a carriage control character but no data following it. This should be ignored.
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 20, 2007 9:06 pm
Reply with quote

You can use an OMIT statement to remove those records. You'd have to show me what those records look like in hex for me to give you the OMIT condition. You can use this DFSORT job to display the records in hex:

Code:

//SHOWV EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN  DD DSN=...  input file
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTREC FIELDS=(1,4,1,4,HEX,5,HEX)
/*
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Wed Feb 21, 2007 7:11 am
Reply with quote

Frank,

OMIT worked. Although records sizes and positions have changed since then, I was able to use your original code and modify it appropriately.

Thanks a lot!
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
Search our Forums:

Back to Top