MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Formatting of Trailer1 in sort/icetool

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Mon Dec 08, 2003 10:57 am    Post subject: Formatting of Trailer1 in sort/icetool Reply with quote

Hi,I am facing problems trying to format the Trailer1 fields.

The control card
SORT FIELDS=(some criteria)
INCLUDE=( some conditions),
TRAILER1=(<part1>,<part2>,<part3>,COUNT,<part4>)

The requirement that I have is
<part1> = This need to be a 16 byte field, should contain the "High-value"
<part2> = 6 byte field, simple constant X(6), For eg. "ENDREC"
<part3> = 3 byte numeric field, but again a constant 9(3), For eg "008"
COUNT = This is the count function of the sort, but I need it to be in S9(09) COMP-3 format. I do not know what is the default format of the COUNT function.
<part5> = FILLER of 10 bytes

It would be great if anyone can help me with this.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 08, 2003 11:57 am    Post subject: Reply with quote

For information on how DFSORT formats relate to COBOL formats, see the "What are the equivalent DFSORT formats for various COBOL data types?" Ask Professor Sort item at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/

It's not clear to me what you want:

<part1> - what do you mean by "High-value"? Do you mean a constant like X'FF.FFF' or C'9...9' or something else?
<part2> - just use C'ENDREC'
<part3> - what is the position, length and format of this numeric field? Do you want to convert it to a value like '008' or is it already a value like '008'?
COUNT - with DFSORT, you can format the COUNT to various printable formats in TRAILER1 but you can't directly convert it to PD format in TRAILER1. You could use TRAILER1 to get the COUNT as a ZD value using COUNT=(M11,LENGTH=9) and then use another COPY step to convert the COUNT to PD using p,9,ZD,TO=PD,LENGTH=5.
<part5> - if you want 10 bytes of blanks as the FILLER,you can use 10X. If you want something else as the FILLER, what do you want?

I can show you how to do what you want with DFSORT, but I need the answers to the questions above. Also, what is the RECFM and LRECL of the input data set?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Fri Aug 25, 2006 6:31 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Mon Dec 08, 2003 1:18 pm    Post subject: Reply with quote

Hi Frank,
<Part 1>: I need High-values as decribed by Cobol "High-values", in the first 16 bytes. I tried giving X'FFFFFFFFFFFFFFFF' earlier but it showing me some syntax errors. I think I am not giving it properly.
<Part 2> this follows Part 1 immediately
<Part 3> is 3 byte numeric field imediately after the above 2 fields. i.e 20-22 bytes.
<COUNT> Will I need another pass on my data to just reformat the COUNT field to comp-3 format ?
<Part 4> I just want the 10X filler.

It would be great if you could let me know. Thanks for such prompt response
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 08, 2003 1:57 pm    Post subject: Reply with quote

Well, you didn't really answer all of my questions, but I'll guess at what you need. I'm assuming that your input file has RECFM=FB and LRECL=80. I'm also assuming that you want your output data set to be FB, not FBA, without carriage control characters. Here's a DFSORT/ICETOOL job that will do what I think you want:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=..  input file
//RCDS DD DISP=MOD,DSN=...  output file - MOD
//TRLR DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
* Sort records to MOD output file (RCDS) and get ZD COUNT.
  SORT FROM(IN) USING(CTL1)
* Set up TRAILER with constants and PD COUNT and
* MOD to end of output file (RCDS).
  COPY FROM(TRLR) TO(RCDS) USING(CTL2)
//CTL1CNTL DD *
  INCLUDE COND=(condition)
  SORT FIELDS=(fields)
  OUTFIL FNAMES=RCDS
  OUTFIL FNAMES=TRLR,NODETAIL,REMOVECC,
    TRAILER1=(COUNT=(M11,LENGTH=9))
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(16X'FF',C'ENDREC',C'008',
    1,9,ZD,TO=PD,LENGTH=5,10X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Mon Dec 08, 2003 7:28 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Mon Dec 08, 2003 3:38 pm    Post subject: Reply with quote

Hi Frank,
Yes, the file is FB type and u can assume 80 byte length. I want to format the TRAILER1 itself (Not the OUTREC) so that I get the High-values i.e 'FF' in the first 16 bytes. Is this possible. Currently when I give
TRAILER1=(16X'FF',C'ENDFIL',C'008',COUNT,10X)
it gives me the syntax error
<<TRAILER1=16X'FF',C'ENDFIL',C'008',COUNT,10X)
$
ICE007A 6 SYNTAX ERROR
>>
Frank, Also I want to avoid an extra pass over the data to format the count. If that cannot be achived in the single pass, I am comfortable in retaining the Count in ZD format, but in 9 bytes. But I have to get the High-Values in the first 16 bytes.

thanks for your prompt responses
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 08, 2003 4:55 pm    Post subject: Reply with quote

da one,

TRAILER1 does not support nX'hh', so you can't use TRAILER1 for 16X'FF'.

I assumed that you wanted to write the data records and a trailer record. Is that correct, or do you just want to write the trailer record (no data records)? Assuming you do want the data records:

Please try the job I gave you. It will give you what you want. It does two passes over the records, but the second pass is only for 1 record, so it's so close to a single pass that it doesn't matter.

To explain further:

In the first pass, I copy all of the records and create a "count" record with the ZD COUNT. In the second pass, I only read that one "count" record and reformat it to one "trailer" record in the form you want, which I MOD on to the data records.

So in the first pass, I'm reading n records and writing n+1 records. In the second pass, I'm reading 1 record and writing 1 record. Thus, in total, the job reads n+1 records and writes n+2 records. Using TRAILER1 (if you could), you would read n records and write n+1 records. The difference in the number of records read and written is insignificant.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 08, 2003 5:04 pm    Post subject: Reply with quote

Da_one,

You are missing an opening parenthesis on your trailer statement.you should have

TRAILER1=(16X'FF',C'OUTREC',C,'008',COUNT,10X,80:X)

You cannot format the count to packed decimal format on the trailer parm. But as you said you are ok with the ZD format with 9 byte length

TRAILER1=(16X'FF',C'OUTREC',C,'008',COUNT=(M11,LENGTH=9),10X,80:X

The following JCl will give the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD DSN=YOUR INPUT DSN,
//             DISP=SHR                                                     
//SORTOUT   DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)                   
//SYSIN     DD *
  SORT FIELDS=(some criteria)
  INCLUDE=( some conditions),
  OUTFIL REMOVECC,OUTREC=(1,80),                                       
  TRAILER1=(81,16,C'OUTREC',C,'008',COUNT=(M11,LENGTH=9),10X,80:X)
/*                                                               


Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 08, 2003 6:08 pm    Post subject: Reply with quote

Kolusu,

I don't understand what you're doing here. As I said, 16X'FF' is invalid in TRAILER1. You seem to be using 81,16 to try to get 16X'FF', but 81-96 doesn't contain 16X'FF'. I don't see any way to put 16X'FF' in 81-96 so TRAILER1 will pick it up and then remove it from 81-96 in ONE pass. What did you have in mind? You might want to try it to see if it works or not.

You also have C, '008' which is invalid syntax. It should be C'008'.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 08, 2003 6:22 pm    Post subject: Reply with quote

Frank,

I actually had an INREC statement which I missed out on the posting.The actual control cards should be as follows

Code:

  INREC FIELDS=(1,80,16X'FF')
  SORT FIELDS=(some criteria)
  INCLUDE=( some conditions),
  OUTFIL REMOVECC,OUTREC=(1,80),                                       
  TRAILER1=(81,16,C'OUTREC',C'008',COUNT=(M11,LENGTH=9),10X,80:X)


The extra comma was a typo.sorry about that.Thanks for pointing that.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 08, 2003 7:26 pm    Post subject: Reply with quote

Kolusu,

Oh, I see. This works because TRAILER1 picks up the 16X'FF' from 81-96 of the last INREC RECORD before the OUTREC parameter removes 81-96. Good exploitation of a subtle point.

BTW, you don't need the 80:X in TRAILER1 - the length of TRAILER1 will be set from the OUTREC parameter.

Of course, this doesn't produce the PD count field, but then I guess that was optional.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 23, 2004 1:09 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can now use nX'hh' and stats=(to) in the TRAILERx parameter, so this can be done more easily and efficiently in one pass like this:

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
 OPTION COPY
 OUTFIL REMOVECC,
  TRAILER1=(16X'FF',C'ENDREC',C'008',
    COUNT=(TO=PD,LENGTH=5),10X)
/*


For complete information on all of the new DFSORT and ICETOOL functions available with these DFSORT PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Tue Aug 02, 2005 8:09 pm    Post subject: Reply with quote

Hi,
When i tried the following the sort card, i am getting a syntax error , it will be great if some one can help me in that..

Code:
SYSIN :                                                           
  SORT FIELDS=COPY                                                 
  OUTFIL NODETAIL,REMOVECC,                                       
  TRAILER1=('HDDETAILS',3X,DATENS=(4MD),COUNT=(M11,LENGTH=5))     
                                             *

_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Aug 02, 2005 9:18 pm    Post subject: Reply with quote

You didn't show the error message, but I'm guessing from the * under the = that it's a WER message which means you're using Syncsort, not DFSORT. DFSORT supports COUNT=(edit). The error message with the * under the = is telling you that Syncsort does NOT support it. Note that DFSORT also supports COUNT=(to), e.g. COUNT=(TO=ZD,LENGTH=5).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Aug 03, 2005 6:55 am    Post subject: Reply with quote

Shivraj,

As frank mentioned older version of syncsort does not support the formatting of the count field. However the new syncsort z/os 1.2 version supports the formatting. Here is an alternative way of getting the desired results.

Code:

  SORT FIELDS=COPY                                               
  OUTREC FIELDS=(C'00001',30:X)                                   
  OUTFIL NODETAIL,REMOVECC,                                       
  TRAILER1=('HDDETAILS',3X,DATENS=(4MD),TOT=(1,5,ZD,M11,LENGTH=5))


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Wed Aug 03, 2005 1:54 pm    Post subject: Reply with quote

Frank Yaeger, kolusu,

Smile Its working,,, Thanks a lot Very Happy
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group