View previous topic :: View next topic |
Author |
Message |
radkrish Beginner
Joined: 12 Aug 2005 Posts: 102 Topics: 19
|
Posted: Sat Aug 20, 2005 11:26 am Post subject: fetched fields alone in the dataset |
|
|
Iam running a SELECT query in the JCL.
When i open the the dataset,it shows
sqlcode 00
5 rows retrieved
....
...
and then the value of the fetched field.
I need the data of fetched fields alone in the o/p dataset and don't need the sql informations.
how do i get it? |
|
Back to top |
|
|
radkrish Beginner
Joined: 12 Aug 2005 Posts: 102 Topics: 19
|
Posted: Sat Aug 20, 2005 11:28 am Post subject: |
|
|
Adding to the above,In the where clause i need the system date.Also pls let me know the parameter to get it in the query. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Sun Aug 21, 2005 2:30 am Post subject: |
|
|
radkrish,
Please search before posting. Check this link
http://mvsforums.com/helpboards/viewtopic.php?t=4054&highlight=unload
Quote: |
Adding to the above,In the where clause i need the system date.Also pls let me know the parameter to get it in the query.
|
you can code current date in your where clause
ex:
Code: |
SELECT *
FROM TABLE
WHERE DATE_COLUMN = CURRENT DATE
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
radkrish Beginner
Joined: 12 Aug 2005 Posts: 102 Topics: 19
|
Posted: Tue Aug 23, 2005 1:04 am Post subject: |
|
|
When i run this query,it always gives this warning message.
.JAAA 0 DSS8094A - DB2 USING DSN RETRY DEFAULT
JCL submission was successfull.but why was it so?
Edit : Found that its an advisory message. |
|
Back to top |
|
|
stalin Beginner
Joined: 22 Aug 2005 Posts: 23 Topics: 4
|
Posted: Wed Aug 24, 2005 3:23 am Post subject: to insert a field in the dataset |
|
|
Dear kollsu,
i have a flat file with
record length : 80
block size :800
record format :FB
we are not sure of how many records it has. But we need to insert a value
ABC1 in the first record in 10th position .
the next record Should have the value ABC2 in the same position and so on.
for exp.
rama 2345 ABC1
ravi 4566 ABC2
KRIS 5677 ABC3
.
the program should let us know what was the last value got inserted in that particular position.
can you please help me on this
THE LENGTH OF THE INSERTED FIELD IS 4.
. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Wed Aug 24, 2005 7:54 am Post subject: |
|
|
Stalin,
Please try to spell the names correctly.
Quote: |
we are not sure of how many records it has. But we need to insert a value ABC1 in the first record in 10th position . the next record Should have the value ABC2 in the same position and so on.THE LENGTH OF THE INSERTED FIELD IS 4.
|
If your field length is only 4 bytes, what value do you want if you have 10 records? Do you want to reset back to 1?
Quote: |
the program should let us know what was the last value got inserted in that particular position.
|
You mean to say , the program needs to make phone call to you and tell you the last value it inserted?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
stalin Beginner
Joined: 22 Aug 2005 Posts: 23 Topics: 4
|
Posted: Wed Aug 24, 2005 11:41 pm Post subject: yes it has to make a phone call |
|
|
Yes it has to make a phone call and say this to me |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Aug 25, 2005 6:47 am Post subject: |
|
|
Quote: |
Yes it has to make a phone call and say this to me
|
Stalin,
Follow these steps
1. Sign up for new phone with the following details
Code: |
Name : Cobpgm
Adress : 16 MB Z/OS operating system Drive
Mainframe City
IBM - XXXX1
|
2. Employ another person/robot to live at that address.
So as soon your pgm completes, he can call you and tell you the details.
Hope this helps...
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
stalin Beginner
Joined: 22 Aug 2005 Posts: 23 Topics: 4
|
Posted: Mon Aug 29, 2005 1:48 am Post subject: how toinsert a field |
|
|
Dear Kolusu, lets stop fighting for a while and i kindly request you to help me out...i will explain my problem clear, to my level best...
i have a dataset with
Record Format : FB
Record Length : 80
Block Size :800
we are not sure of the total number of records.
i need to insert a 8 digit Alpha numeric character(which we call it as TAG) in 10th position in each of the record.
For example:
arun abc12345
ramesh abc12346
kumar abc12347
.
.
.ravi abc12349
.raghu abc12350 (please see the tag value gets increased by 1).
ASSUMPTION: THE TOTAL NUMBER OF RECORDS DOES NOT EXCEED 1000.
so,if we give the initial tag value , it has to tag all the records and finally it has to let the programmer know the last value of the Tag that has been inserted.
hope i made you understand my problem. suggest me whether it can be done with utilities in JCL or we need to go for a Cobol program. i would like to do it with the utilities rather than cobol...looking forward for your reply with lots of hope.
Thanks
stalin. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Mon Aug 29, 2005 3:57 am Post subject: |
|
|
Quote: |
Dear Kolusu, lets stop fighting for a while and i kindly request you to help me out...i will explain my problem clear, to my level best...
|
You should have realized that before playing along.
The following JCL will give you the desired results.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT DATASET,
// DISP=SHR
//OUT DD DSN=YOUR OUTPUT DATASET,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//CNT DD DSN=YOUR HIGHEST SEQNUM FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,9, $ COPY FIRST 9 BYTES FROM INPUT
C'ABC', $ CONSTANT ABC
SEQNUM,5,ZD) $ 5 BYTE SEQNUM
OUTFIL FNAMES=OUT
OUTFIL FNAMES=CNT,NODETAIL,REMOVECC,
OUTREC=(1,17,80:X),
TRAILER1=(C'THE HIGHEST NUMBER INSERTED IS: ',13,5)
/*
|
The next step code an email step to send "your highest seqnum file" to you via smtp
check these links which explains about sending email.
http://www.mvsforums.com/helpboards/viewtopic.php?t=439&highlight=mail
http://www.mvsforums.com/helpboards/viewtopic.php?t=3223&highlight=mail
http://www.mvsforums.com/helpboards/viewtopic.php?t=2667&highlight=mail
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Mon Aug 29, 2005 9:56 am Post subject: |
|
|
Kolusu,
As per Stalin's sample output, the running number is not having leading zeroes, whereas your step will put the sequence number with leading zeroes.
Also, he says, Quote: | so,if we give the initial tag value , it has to tag all the records and finally it has to let the programmer know the last value of the Tag that has been inserted. |
.
So, the SEQNUM operator should have START= too (dynamically, of course).
Did I miss something? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Mon Aug 29, 2005 10:06 am Post subject: |
|
|
Quote: |
Kolusu,
As per Stalin's sample output, the running number is not having leading zeroes, whereas your step will put the sequence number with leading zeroes.
|
Cogito,
Take a look at the stalin post which was posted just above my solution.
Quote: |
ASSUMPTION: THE TOTAL NUMBER OF RECORDS DOES NOT EXCEED 1000.
|
His requirements are not clear. If the max no: of records is less than 1000 , why do you need a 5 byte seqnum? hmm I don't think stalin wants a dynamic sequence numbering. I may be wrong on that.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
stalin Beginner
Joined: 22 Aug 2005 Posts: 23 Topics: 4
|
Posted: Wed Aug 31, 2005 12:49 am Post subject: Thanks |
|
|
Dear kolusu, thanks for your solution. your program worked good . i made some more modification in the program thats suits my exact requirement. i will be back soon withsome more quries.
Warm regards.
Stalin |
|
Back to top |
|
|
|
|