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

How to write record count in header??


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

New User


Joined: 01 Apr 2006
Posts: 17
Location: Pune

PostPosted: Wed Jul 18, 2007 5:30 pm
Reply with quote

I have a sequential file sorted on key 40,9 of record length 118 and now i want to take the record count in header part.
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 Jul 18, 2007 7:56 pm
Reply with quote

It's not clear what exactly you want to do. You need to give more detailed information.

Show an example of the records in your input file (relevant fields only) and what you expect for output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of the relevant input fields.
Back to top
View user's profile Send private message
sandy_mcs

New User


Joined: 01 Apr 2006
Posts: 17
Location: Pune

PostPosted: Thu Jul 19, 2007 9:56 am
Reply with quote

I am fetching data from tables in my JCL and writing in file, but as per the requirement output file should have a header which is of a fixed structure and in that header record count is also there, previously merge was enough because header was not containing record count,
Record Format : FB
LRECL : 120

Record format is as shown below:
LAST_NAME DATE_BRTH CARD_NO HOUSE NUMBER
------------------------------------------------------------------------------------
MCSPARRON 05.10.1977 000136704 1 GREYSTONE PARK
FERRAR 30.12.1975 000183090 BULL LANE
SINCLAIR 29.05.1965 000203204 62 LEABANK ROAD
BEAL 23.07.1920 000226180 15 ST LEONARDS CLOSE

PSTL_CODE LAST_NAME TIME_ADD
-------------------------------------------------------------------
BT49 0EG OWEN 2006-03-07-22.48.57.311301
SL9 8RU WARREN 2005-01-06-11.17.01.704948
DY2 0BB MARK 2002-02-11-14.30.49.255965
YO17 7EW I 2005-05-26-22.49.50.217817


The header should be as below :

TRI/ Current_Date/ Record Count

where, TRI is fixed, current date i will take from a file, but the record count along with these two is what i want to know!
Back to top
View user's profile Send private message
sandy_mcs

New User


Joined: 01 Apr 2006
Posts: 17
Location: Pune

PostPosted: Thu Jul 19, 2007 3:07 pm
Reply with quote

Thank's Frank, your "smart DFSORT tricks" helped me out and i got the solution to my query
The JCL i used to get count of records present in SORTIN in to SORTOUT.

//BOYSG414 JOB (1,SANDEEP),'TESTING',
// USER=BOYSG4,LINES=9999,NOTIFY=&SYSUID,
// CLASS=R,MSGCLASS=T,REGION=40M
//PGM1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=SMOM.SORT3.OUT,DISP=SHR
//SORTOUT DD DSN=SMOM.SORT.ICEOUT,DISP=SHR
//*DFSMSG DD SYSOUT=*
//*SYSPRINT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=4))
/*
//
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Jul 19, 2007 3:15 pm
Reply with quote

Sandy_mcs,

Quote:
The header should be as below :

TRI/ Current_Date/ Record Count


Quote:
OUTFIL NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=4))


How did you get records count in Header when you had used TRAILER1 in the JCL?

Its good to read you had achieved your requirement. But still want to know.
Back to top
View user's profile Send private message
sandy_mcs

New User


Joined: 01 Apr 2006
Posts: 17
Location: Pune

PostPosted: Thu Jul 19, 2007 4:31 pm
Reply with quote

Murali,
In my case it was mandetory to write record count in header part and technical stuff doesnot support to write record counter in header, so i found it better to take the counter in separate file and then merge it with header using outrec field.
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: Thu Jul 19, 2007 8:19 pm
Reply with quote

I would have created a DFSORT symbol for the counter and then used that DFSORT symbol to put the counter into the header.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Jul 20, 2007 11:52 am
Reply with quote

Frank,

Quote:
I would have created a DFSORT symbol for the counter and then used that DFSORT symbol to put the counter into the header.


You mean to say using SYMNAMES statement. But perfomance wise which is best since sandy's approach as well as your approach require two steps for writing the record count in the header.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 20, 2007 12:44 pm
Reply with quote

murmohk1
Quote:
since sandy's approach as well as your approach require two steps

sandy_mcs is half way through!
However Sandy has extracted the COUNT, further dont know how to write it as a header icon_confused.gif
So, here after Sandy needs franks help in writing the header.

Hence, u find no 2 approches here. Just the thing is if you are using SYMNAMES approach, u will be using the o/p extracted from sandy_mcs, as the i/p to SYNAMES in next step.
u can see an example here http://ibmmainframes.com/viewtopic.php?t=21562&postdays=0&postorder=asc&start=15
But my idea was if the DATE field in the header was CURRENT(RUN) date then no need of SYMNAMES, U can build the whole HEADER in the same step where you are extracting the count, and concatenate it with the set of detail records in the next step.
However this also takes 2 steps icon_eek.gif , but avoids over head in building the header by reading the DATE field from some other file.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Jul 20, 2007 1:54 pm
Reply with quote

Krisprems,

Quote:
However Sandy has extracted the COUNT, further dont know how to write it as a header


Using TRAILER1 option, Sandy created a record (only one record) with record count. Say this as FILE1. In the next step, he concatenated FILE1 with the actual data.

Quote:
But my idea was if the DATE field in the header was CURRENT(RUN) date then no need of SYMNAMES

You are right. But Sandy requires record count in the Header which cannot be achieved through HEADER1 option. So he followed the above mehtod.

Quote:
However this also takes 2 steps , but avoids over head in building the header by reading the DATE field from some other file.

Both Frank and Sandy approach require 2 steps (as I said before). Just wanted to know which is efficient.
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 Jul 20, 2007 8:28 pm
Reply with quote

Quote:
You mean to say using SYMNAMES statement


You create the DFSORT symbol in the first step and use it via the SYMNAMES data set in the second step.

Quote:
But perfomance wise which is best


The only way to know that for a particular case is to try both ways and compare.
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top