Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Skipping records
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Tue Aug 12, 2008 10:37 pm    Post subject: Skipping records
Reply with quote

Hi I have two files.... Both are created in same program but in different runs, both have header and trailer records... These file are input to next job... I want merge these two files into one file...i want skip header and trailer in second file and insert those records into first file just before first file trailer recods. Please provide me to do this. Actually first file trailer record got number of records, i want change that also. Is it possible changing that value while merging itself?

Please clarify my doubts...

Regards,
Sasikumar.K
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Aug 12, 2008 11:27 pm    Post subject:
Reply with quote

You need to give more and clearer information.

Show an example of the records in each input file (relevant fields only) and what you expect for output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of all relevant fields.

Are you "merging" on a key? If so, give the starting position, length and format of the key.

Or are you copying without a key?

Is there anything in the header record that identifies it as a header record (e.g. 'H' in position 1)? If so, what?

Is there anything in the trailer record that identifies it as a trailer record (e.g. 'T' in position 1)? If so, what?
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Wed Aug 13, 2008 7:23 am    Post subject: Merging the files
Reply with quote

Hi Frank,

Thanks for ur reply...

Both the files are created using same program, but in different runs... So both the files record length(1173) and the files record format are same (VB)... Please find below ex for how the files looks....

File1: myfiles.outpu1

kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
uqynwnddskjdhasjdhapduasduapo
dashdjshadljsdhladhdasdaew
triler records ssssssss 4 trailer recrod
triler record end


File 2: myfiles.output2

ehjqwhejkhwkjqnmansasadasdmn
dmsandkjsadkjsdjkdsadasdasdasdsadsd
dsjhadksjhdkjsahdkjsadhkjashdkjs
triler records ssssssss 3 trailer recrod
triler record end

My output should be as below


kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
uqynwnddskjdhasjdhapduasduapo
dashdjshadljsdhladhdasdaew
ehjqwhejkhwkjqnmansasadasdmn
dmsandkjsadkjsdjkdsadasdasdasdsadsd
dsjhadksjhdkjsahdkjsadhkjashdkjs
triler records ssssssss 7 trailer recrod
triler record end


And my output file name should be same as first file nam. i.e myfiles.outpu1

There is no header record. Only trailer record is there.. That can be found using 'ssssssss' in a particular position(say in 37th position and its length is 8).... You can see 4 in first file trailer record and 3 in second file trailer record, my output file record contains 7. I just wanted to add 4 + 3 and write in output file. Becos this number is not total number of records in that file. It comes in different way. So i wanted just to add it.

Please give me some suggestions how to complete this.

Can i use same file name for input and output while merging??
Like below...

Input files : myfiles.outpu1
myfiles.outpu2

Output file: myfiles.outpu1


Regards,
Sasikumar.K
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Wed Aug 13, 2008 7:24 am    Post subject: Sorting
Reply with quote

Frank,

I am not merging the records based on the key... Just wanted to copy both the files and need output as i mentioned in my previous message.

Regards,
Sasikumar.K
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Aug 13, 2008 10:57 pm    Post subject:
Reply with quote

I still have some questions:

You show two 'triler' records in each file. Are there exactly two trailer records in each file and can they be identified by 'triler'? Or are there more than two trailer records in each file? If so, how many (can it vary) and can they all be identified by 'triler'? Is the one with the count the only one with 'ssssssss'?

You show the count in the trailer record you want to replace as one character and don't say where it starts. I assume it's really more than one character, so how long is it, where does it start and what is its format (ZD, PD, something else))?

Quote:
Can i use same file name for input and output while merging??


You are NOT merging, you're copying. And no, you can't use the same file name for input and output while copying or merging.
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Aug 14, 2008 7:26 am    Post subject:
Reply with quote

HI Frank,

Thanks for ur reply....

There will be only two trailer records. Both can be identified 'SSSSSSSS' at position 30 to 37. Only the first trailer record is having the count. So i need to replace that only.

The count starts at 40 to 48 and its PD format (PIC S9(9)).

Please provide me sample code...

Regards,
Sasikumar
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 14, 2008 9:39 am    Post subject:
Reply with quote

Sasikumar,

Quote:
The count starts at 40 to 48 and its PD format (PIC S9(9)).


AFAIK, PIC S9(9) in PD format will occupy only 5 bytes and not 9 bytes as your file postions indicate.


Thanks,
Arun
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Aug 14, 2008 11:42 am    Post subject:
Reply with quote

Arun,

Ya it takes 5 bytes... I just gave Eg record like that... instead of in hex format....


Frank,

Any help on this for me??
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 14, 2008 11:59 am    Post subject:
Reply with quote

Quote:
The count starts at 40 to 48 and its PD format (PIC S9(9)).


Can you tell where exactly your count starts and where it ends?

Thanks,
Arun
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Aug 14, 2008 3:24 pm    Post subject: Skipping records
Reply with quote

Arun,

Ok, i have given ex like that.. forget abt that...

it starts at 40 and ends at 45 and its PD format.

I just want to merge second file data before the trailer records of the first file and change the trailer record count and eliminate second file trailer.

Please send me sample sort card for this.

Regards,
Sasikumar.K
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 14, 2008 7:01 pm    Post subject:
Reply with quote

Sasikumar,

Quote:
There will be only two trailer records. Both can be identified 'SSSSSSSS' at position 30 to 37. Only the first trailer record is having the count


Is there any way to identify the 2nd trailer record. Do the 2nd trailer records for both the files differ?

Thanks,
Arun
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Aug 14, 2008 9:49 pm    Post subject:
Reply with quote

Hi Arun,

Second trailer record also same as first trailer record. Not as i mentioned before. See correct Eg below. I should not reduce the trailer records from two to one. Let it be two itself. But i want change count in it during merging.

File1: myfiles.outpu1

kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
uqynwnddskjdhasjdhapduasduapo
dashdjshadljsdhladhdasdaew
triler records ssssssss 4 trailer recrod
triler records ssssssss 4 trailer recrod


File 2: myfiles.output2

ehjqwhejkhwkjqnmansasadasdmn
dmsandkjsadkjsdjkdsadasdasdasdsadsd
dsjhadksjhdkjsahdkjsadhkjashdkjs
triler records ssssssss 3 trailer recrod
triler records ssssssss 3 trailer recrod

My output should be as below


kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
uqynwnddskjdhasjdhapduasduapo
dashdjshadljsdhladhdasdaew
ehjqwhejkhwkjqnmansasadasdmn
dmsandkjsadkjsdjkdsadasdasdasdsadsd
dsjhadksjhdkjsahdkjsadhkjashdkjs
triler records ssssssss 7 trailer recrod
triler records ssssssss 7 trailer recrod


Please provide sample code, let me try with that and with my own tricks too...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 14, 2008 10:29 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed that the positions you gave did not count the 4-byte RDW, so the 'SSSSSSSS' identifier actually starts in position 34 and the 6 byte PD count actually starts at position 44.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (VB)
//IN2 DD DSN=...  input file2 (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T2) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'1',6:SEQNUM,8,ZD,14:5)),
    IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
      OVERLAY=(5:C'9',6:SEQNUM,8,ZD))
/*
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'2',6:SEQNUM,8,ZD,14:5)),
    IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
      OVERLAY=(5:C'9',6:SEQNUM,8,ZD))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN02 DD DSN=&&T2,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
  MERGE FIELDS=(5,9,ZD,A)
  OPTION EQUALS,VLSHRT
  SUM FIELDS=(53,6,PD)
  OUTFIL BUILD=(1,4,5:14)
/*
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Aug 14, 2008 11:14 pm    Post subject:
Reply with quote

HI Frank,

Thanks for your reply...

I dont think our shop allows to use ICEMAN and ICETOOL.... Becos i have never seen these tools in my productions except in IBM Mainframes... I have been asked to do by using SORT utility..... Can you please tell me how to achieve it by using SORT utility....

Quote:
I assumed that the positions you gave did not count the 4-byte RDW, so the 'SSSSSSSS' identifier actually starts in position 34 and the 6 byte PD count actually starts at position 44.

I really dont understand this...

I said 'SSSSSSSS' is present in both the trailer records, and at postion 40 total number of record count will be there and its in PD format... I really dont know difference between ZD and PD...

And also the code which you gave is very complex for me to understand.... please provide me sample code using SORT utility....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 14, 2008 11:26 pm    Post subject:
Reply with quote

Quote:
please provide me sample code using SORT utility


I did.

DFSORT is the SORT utility. PGM=SORT and PGM=ICEMAN invoke DFSORT. PGM=ICETOOL invokes DFSORT's ICETOOL utility. If you have DFSORT, then you have ICETOOL (ICETOOL has been shipped with DFSORT since 1991). The job works fine based on the information you gave me. Try the job and see if it works. If it doesn't work, then you didn't give me correct information. If you get error messages, post them.

As for the positions. You said your file is a VB file. Each VB record has an RDW (record descriptor word) in positions 1-4 that gives the length of the record. So the data bytes actually start at position 5, not position 1. So when you said that your field starts in position 30, I assumed you were not counting the RDW in positions 1-4. Thus, we actually have to add 4 for the RDW and your field really starts in position 34.

BTW, I assumed you have 'ssssssss' (lower case) as the identifier as shown in your input record examples. If you actually have 'SSSSSSSS' (upper case) then change 'ssssssss' to 'SSSSSSSS' in the control statements.

Quote:
I really dont know difference between ZD and PD


A PD value would look like this in hex:

dddd...ds

where d is 0-9 and s is the sign (usually C, F or D)

A ZD value would look like this in hex:

FdFd...sd

where again d is 0-9 and s is the sign (usually C, F or D)

If your count field is actually ZD, change PD to ZD in the SUM statement (that's where I'm adding the counts from the trailer records).
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Fri Aug 15, 2008 6:33 am    Post subject: Thanks a lot Frank
Reply with quote

Hi Frank,

Thanks a lotttttttttttttt.. really i got shocked when i saw ur reply.... ur explainaton was superb....

For me today is holiday, so i will try it 16th August and let u know my status....

Meanwhile i will just go thru ur code and if i have any doubts, i will post it... i just worked in IMS DB, and COBOL.... but not in SORT utilities... thats the reason i couldnot able to catch what u have posted.... Thanks again Frank.....


Regards,
Sasikumar 'Franks is greattttttttttt'
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Fri Aug 15, 2008 5:43 pm    Post subject: Few doubts
Reply with quote

Hi Frank,

Just gone thru ur code....

I have few doubts, and here are they...

BUILD=(1,4,5:C'1',6:SEQNUM,8,ZD,14:5))

OVERLAY=(5:C'9',6:SEQNUM,8,ZD))

OPTION EQUALS,VLSHRT

I dont understand all the above lines..

One more doubt... With this code my output file contains records of both input files and at end only two trailer records having sum of the records in count field. Why i am asking was i dont understand anything just seeing the code to come up an assumption that i get my required output...

Dont mistake me that i am asking many questions... i am not much good in SORT and other JCL utilities... But now started learning...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Aug 15, 2008 9:49 pm    Post subject:
Reply with quote

Quote:
One more doubt... With this code my output file contains records of both input files and at end only two trailer records having sum of the records in count field. Why i am asking was i dont understand anything just seeing the code to come up an assumption that i get my required output...


Yes, that's what the output will contain ... it's what you asked for. When I tested the job with P'3' for the count in the two input file1 trailer records and P'4' for the count in the two input file2 trailer records, the result had the data records from file1, followed by the data records from file2, followed by two output file trailer records with P'7' for the count.

Here's an explanation of how the job works. Note that I'm showing the count as readable as you did for illustration, but according to what you said, it's really an unreadable PD value.

Code:

  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'1',6:SEQNUM,8,ZD,14:5)),
    IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
      OVERLAY=(5:C'9',6:SEQNUM,8,ZD))


This builds a merge key by reformatting the input file1 records to look like this in the T1 data set:

Code:

     merge--key
|RDW|1|00000001|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|1|00000002|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|1|00000003|uqynwnddskjdhasjdhapduasduapo
|RDW|1|00000004|dashdjshadljsdhladhdasdaew
|RDW|9|00000001|triler records ssssssss 4 trailer recrod
|RDW|9|00000002|triler records ssssssss 4 trailer recrod


Code:

  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'2',6:SEQNUM,8,ZD,14:5)),
    IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
      OVERLAY=(5:C'9',6:SEQNUM,8,ZD))


This reformats the input file2 records to look like this in the T2 data set:

Code:

     merge--key
|RDW|2|00000001|ehjqwhejkhwkjqnmansasadasdmn
|RDW|2|00000002|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|2|00000003|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|9|00000001|triler records ssssssss 3 trailer recrod
|RDW|9|00000002|triler records ssssssss 3 trailer recrod


Now we can use the merge key in the reformatted records to MERGE the T1 and T2 files with these control statements:

Code:

  MERGE FIELDS=(5,9,ZD,A)
  OPTION EQUALS,VLSHRT
  SUM FIELDS=(53,6,PD)
  OUTFIL BUILD=(1,4,5:14)


5.9,ZD,A merges on the merge key. EQUALS ensures that the trailer records are merged in their original order. So the merged records look like this:

Code:

     merge--key
|RDW|1|00000001|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|1|00000002|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|1|00000003|uqynwnddskjdhasjdhapduasduapo
|RDW|1|00000004|dashdjshadljsdhladhdasdaew
|RDW|2|00000001|ehjqwhejkhwkjqnmansasadasdmn
|RDW|2|00000002|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|2|00000003|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|9|00000001|triler records ssssssss 4 trailer recrod
|RDW|9|00000001|triler records ssssssss 3 trailer recrod
|RDW|9|00000002|triler records ssssssss 4 trailer recrod
|RDW|9|00000002|triler records ssssssss 3 trailer recrod


Notice the pairs of trailer records have duplicate merge keys of 900000001 for the first pair and 900000002 for the second pair. So these are the only pairs of records that are summed by the SUM statement. The counts for each pair are added and only one record of the pair is kept, resulting in two trailer records with the total count in each:

Code:

|RDW|9|00000001|triler records ssssssss 7 trailer recrod
|RDW|9|00000002|triler records ssssssss 7 trailer recrod


VLSHRT is needed to ensure that we do not terminate due to "short" records for the SUM statement (that is, records shorter than 58 bytes).

Finally, the OUTFIL statement removes the merge key from each record, so SORTOUT has:

Code:

|RDW|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|uqynwnddskjdhasjdhapduasduapo
|RDW|dashdjshadljsdhladhdasdaew
|RDW|ehjqwhejkhwkjqnmansasadasdmn
|RDW|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|triler records ssssssss 7 trailer recrod
|RDW|triler records ssssssss 7 trailer recrod


I hope this helps.
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Fri Aug 15, 2008 11:15 pm    Post subject: Thanks a lot...
Reply with quote

Thanks a lot for ur explaination Frank..... i will be using this tomorrow.....

Once again thanks a lotttttttttt....

Ur great...
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sat Aug 16, 2008 3:53 pm    Post subject: Some issues
Reply with quote

Hi Frank,

please check my input file record in the attachment i did in previous message, with the code you have provided i got output like merged both the files just like it...

After the first file records just second file records are merged... So first first file trailer record has come just before second file records and second file trailer record has come at end of the file.. and the sum of the records also not done... please see my input...

attachment removed and needs to be re-posted with copy/paste rather than "screenshot".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us