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 

need total number of records & system date in sep file
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Thu Jan 30, 2003 1:07 pm    Post subject: need total number of records & system date in sep file Reply with quote

Hi,

I have a sequential file of 180 lrec..

I want in the output file the hardcode string, total number of records and the system date in the output file as follows :

Header Name : IBM CORPORATAION (x(25))
Total count : x(08)
Date : MM/DD/YYYY (x(10))

Total Lenght is : 43

Is it prossible by any sort utility..

Any help is highly appreciated.
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: Thu Jan 30, 2003 3:20 pm    Post subject: Reply with quote

Anand,

You can do this with the following DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT  DD DSN=... output file (1 record)
//SYSIN    DD    *
 OPTION COPY
 OUTFIL REMOVECC,NODETAIL,
  OUTREC=(43:X),
  TRAILER1=('IBM CORPORATION',
    26:COUNT,
    DATE=(MD4/))
/*


This will produce a RECFM=FB, LRECL=43 data set for SORTOUT with one record like this (for the example, the input file has 19 records):

Code:

IBM CORPORATION                1901/30/2003


You can change the format of the count using DFSORT's COUNT=(edit) option. If you want the count in a different format, let me know what you want and I'll show you how to get it.
_________________
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
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Fri Jan 31, 2003 1:17 am    Post subject: Reply with quote

Frank,
Where do I find docs on nodetail, trailer,removecc etc...
________
DL1000 V-Strom


Last edited by coolman on Sat Feb 05, 2011 1:17 am; edited 1 time in total
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 31, 2003 4:27 am    Post subject: Reply with quote

Hi Frank,

Thanks a lot for ur response.. I have small change in my requirement..

Instead of hardcoding string.. I need to capture the string which exist in the last record of the input file starts from 30 to 70.

Could u please modify the code to incorporate the new requirement.

Thanks
anand
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 31, 2003 7:02 am    Post subject: Reply with quote

Hi Frank,

I tried ur jcl... I am getting U00016
Code:

SYSIN :
 OPTION COPY
        *
 OUTFIL REMOVECC,NODETAIL,
        *
   OUTREC FIELDS=(43:X),
                       *
   TRAILER1=('IBM CORPORATION',
     26:COUNT,
     DATE=(MD4/))

WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000

I was trying to resolve but I don't find the error onoutrec statements and control statement..Can u help me on this

Thanks
Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2003 7:14 am    Post subject: Reply with quote

Anand,

Your control cards should start in Pos 2. I am sorry to inform you that frank's example will not work in your case , as you have syncsort which does not support removecc functionality as DFSORT does. I will post the Syncsort solution a little bit later as I am in a hurry. But till then you can try with the following control cards.
Code:

  SORT FIELDS=COPY
  OUTFIL NODETAIL,OUTREC=(43:X), 
  TRAILER1=('IBM CORPORATION',
                     26:COUNT,
                     DATE=(MD4/))


Make sure that your control cards start from position 2.I will post the solution for your new requirement a bit later

Hope this helps...

cheers

kolusu


Last edited by kolusu on Fri Jan 31, 2003 11:36 am; edited 1 time in total
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: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Jan 31, 2003 7:16 am    Post subject: Reply with quote

coolman,

You can find all the information you want in this manual.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/CCONTENTS

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 31, 2003 7:43 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for ur respone.. It worked but the output file is having same lrec as input.. But I want lrecl should be 43...Can u tellme where should I make change..

thanks
Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2003 9:55 am    Post subject: Reply with quote

Anand,

Quote:


Instead of hardcoding string.. I need to capture the string which exist in the last record of the input file starts from 30 to 70.



So that is 40 bytes for the title, and you want 8 bytes for the count and 10 bytes for the date which is a total of 58 bytes. But in the later posts you state that you want only 43 bytes. can you please clarify as to what you want.

I am posting the solution based on your new requirement, ie. take the string from the last record of the input file from pos 30 thru 40 .

A brief explanation of the job.

using inrec we take the bytes 30 thru 70 and we add a seqnum to all the records and also 10 bytes for date.

Now we sort on the seqnum descending so that the last record will be the first record.

Using ENDREC feature we write out only 1 record which is the last record in the file.using the trailer option we add the date at 49 position.

Since trailer1 is a report feature it will create the dataset with an ansi carriage character in the first byte.i.e if the input file is fb then it will be created as FBA.so now the file T1 looks as follows:
Code:

1ANAND CORPORATION LIMITED               00000019           
1                                                01/31/2003 


DFSORT's REMOVECC option can remove this carriage control character and create an FB file. But since you have Syncsort which doesn't support REMOVECC, you need the second operator to take in the above file and make it a single record stripping off the ansi carriage control character in the first byte.The output looks like this
Code:

ANAND CORPORATION LIMITED               0000001901/31/2003


Code:

//STEP0100 EXEC PGM=SYNCTOOL                           
//*                                                     
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                           
//IN       DD DSN=YOUR INPUT FILE,
//            DISP=SHR     
//T1       DD DSN=&T,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//OUT      DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE)
//TOOLIN   DD *                                     
  SORT FROM(IN) USING(CTL1)                           
  SORT FROM(T1) USING(CTL2)                           
//CTL1CNTL DD *                                         
  INREC FIELDS=(30,40,SEQNUM,8,ZD,10Z)                   
  SORT FIELDS=(41,8,ZD,D)                                 
  OUTFIL FNAMES=T1,ENDREC=1,TRAILER1=(48X,DATE=(MD4/))   
//CTL2CNTL DD *                                         
  SORT FIELDS=(1,1,CH,A)                                 
  SUM FIELDS=(50,2,53,2,56,4),FORMAT=BI                   
  OUTFIL FNAMES=OUT,OUTREC=(2,48,50,2,C'/',53,2,C'/',56,4)
/*


Hope this helps....

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 31, 2003 10:41 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for ur solution.. I talked with the user and she wants to hardcode that instead of capturing that from the input file.. The solution that u have given for the user abend had worked out..

Code:

  SORT FIELDS=COPY
  OUTFIL NODETAIL, OUTREC FIELDS=(43:X), 
  TRAILER1=('IBM CORPORATION',
                     26:COUNT,
                     DATE=(MD4/))


But the output file was created with the same logical record length as input. But I want the output file to be 43 length only.

Header : 25
count : 8
Date : 10

Can u pls provide the solution for this..

Thanks
Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2003 10:54 am    Post subject: Reply with quote

Anand,

change your control cards to the following.

Code:

  SORT FIELDS=COPY                                   
  OUTFIL NODETAIL,OUTREC=(43:X),                     
   TRAILER1=('IBM CORPORATION',26:COUNT,DATE=(MD4/)) 


This will create a 44 byte file as the first byte will be the ansi carriage control character. As I said earlier, if the input file format is FB the output file created will be FBA. so if you want to strip off the ansi carriage control character then use the following JCL. The first step creates the report and the next step strips the ansi carriage control character.

Code:

//STEP0100  EXEC  PGM=ICEMAN                               
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD DSN=YOUR INPUT FILE,
//             DISP=SHR                                           
//SORTOUT   DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
//SYSIN     DD *                                         
  SORT FIELDS=COPY                                         
  OUTFIL NODETAIL,OUTREC=(43:X),                           
  TRAILER1=('IBM CORPORATION',26:COUNT,DATE=(MD4/))         
//*
//STEP0200  EXEC  PGM=ICEMAN                               
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD DSN=&T1,DISP=OLD 
//SORTOUT   DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(TRK(1,1),RLSE),
//             RECFM=FB                             
//SYSIN    DD    *                                         
  SORT FIELDS=COPY                                         
  INREC FIELDS=(2,43)                                       
//*


Hope this helps...

cheers

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: Fri Jan 31, 2003 11:21 am    Post subject: Reply with quote

Coolman,

You can access all of the DFSORT books from:

http://www.storage.ibm.com/software/sort/mvs/srtmpub.html

You can find complete information about all of the features of DFSORT's OUTFIL statement (like NODETAIL, REMOVECC, TRAILERn) at:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/3.13?DT=20020722140254
_________________
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: Fri Jan 31, 2003 11:33 am    Post subject: Reply with quote

Anand,

As Kolusu pointed out, the WERxxxs messages mean you have Syncsort. DFSORT supports the REMOVECC option, but Syncsort doesn't. DFSORT has ICExxxs messages.

(Seems like 90% of the posts on this Forum go up while I'm away from work on the West Coast of the U.S. here. By the time I get into work, all the questions have been answered.) Rolling Eyes
_________________
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
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 31, 2003 11:38 am    Post subject: Reply with quote

Kolusu,

I tried it but still T1 file have lrec same as input file. I am posting my job here..
Code:

000003 //S1       EXEC  PGM=ICEMAN
000004 //SYSOUT   DD SYSOUT=*
000005 //SORTIN   DD DSN=Input,DISP=SHR
000006 //SORTOUT  DD DSN=Output,
000007 //            DISP=(,PASS),
000008 //            UNIT=SYSDA,
000009 //            SPACE=(CYL,(1,1),RLSE)
000013 //SYSIN    DD  *
000014   SORT FIELDS=COPY
000015   OUTFIL NODETAIL,OUTREC=(43:X),
000016   TRAILER1=('IBM CORPORATION',26:COUNT,DATE=(MD4/))
000017 /*
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2003 11:52 am    Post subject: Reply with quote

Anand,

The same JCL creates a 44 byte FBA file for me. I am confused as to why you are getting it as input file LRECL. any way try this .

Code:

  INREC FIELDS=(43X)                                   
  SORT FIELDS=COPY                                     
  OUTFIL NODETAIL,                                     
  TRAILER1=('IBM CORPORATION',26:COUNT,DATE=(MD4/))     


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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