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
 

 

Acheive using Mainframe SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
Subhasish Sarkar

New User


Joined: 21 Oct 2011
Posts: 16
Location: India

PostPosted: Fri Oct 21, 2011 3:34 pm    Post subject: Acheive using Mainframe SAS
Reply with quote

Dear All,

Let me clarify my requirement. Please refer to the sample data below.

Code:
   JAN        RC     RC FLAG    ACCNT   AC FLAG     COMBINATION    COMB FLAG
000000900  10000001  NONE      9399999  ERROR     100000019399999  NONE
000000900  10000001  NONE      9399999  NONE      100000019399999  ERROR
000130500  10000001  NONE      1420500  ERROR     100000011420500  NONE
000130500  10000001  NONE      1420500  NONE      100000011420500  ERROR


I need the above data to be written into an output file as below.

Code:
   JAN        RC     RC FLAG    ACCNT   AC FLAG     COMBINATION    COMB FLAG
000000900  10000001  NONE      9399999  ERROR     100000019399999  ERROR
000130500  10000001  NONE      1420500  ERROR     100000011420500  ERROR
Code'd

Please let me know if this could be acheived using Mainframe SAS?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 21, 2011 3:39 pm    Post subject: Reply to: IMPORTANT - Require an urgent Reply.
Reply with quote

Yes it can*.

If it is urgent, you should get on with it straight away.

If you want help on a forum, the last thing you should do is ask for URGENT. 2nd-last thing is ask someone to do the work for you. 3rd-last thing is ask a question which can be yes/no. 4th-last thing is ask a dumb question. Etc. Rearrange to suit. Possibly with SAS.

*I have no idea about SAS, but it looks simple enough. If really URGENT, I'd do it with the editor.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 21, 2011 3:54 pm    Post subject:
Reply with quote

URGENT

There you go, I've replied URGENT icon_lol.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Fri Oct 21, 2011 3:56 pm    Post subject:
Reply with quote

It certainly can be done with SAS -- the LAG1 function might come in handy. However, since you did not provide any clue as to what the rules are for getting the input file to look like the output file, there's not much ANYBODY on this forum could do to help.

Since this is so urgent, I strongly recommend you stop looking at forum posts and start coding SAS.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 21, 2011 3:56 pm    Post subject:
Reply with quote

Yes it can but as you haven't bothered to tell us anything about how the data is selected or anything else, we'll just have to wait until you can be bothered to tell us anything useful.

Please also post your own attempt at this problem and where you have encountered errors
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 21, 2011 4:16 pm    Post subject: Reply to: IMPORTANT - Require an urgent Reply.
Reply with quote

Quote:
COBOL,JCL,Mainframe SAS,VSAM,MCAR,MFS,PLI,COBOL - IMS-DB,DB2


You can do it in Cobol, PL/I. Or your Sort product, rexx... Maybe stick it into an IMS or DB2 database and extract it from there.

Requirement, after clarification, is obviously to keep the headings and then include all the even-numbered data records.

Since you have VSAM as one of your skills, how about having a go at the recent Interview Question, once this urgent thing is out of the way.

And use the Code tags when you around to providing something useful...
Back to top
View user's profile Send private message
Subhasish Sarkar

New User


Joined: 21 Oct 2011
Posts: 16
Location: India

PostPosted: Fri Oct 21, 2011 4:31 pm    Post subject: Reply to: IMPORTANT - Require an urgent Reply.
Reply with quote

Hello All,

Well, I am being more specific to claify the requirement.

My Input File (attached) is sorted on the Field JAN. I give below the first 2 records of the Input File.

JAN RC RC FLAG ACCNT AC FLAG COMBINATION COMB FLAG
000000900 10000001 NONE 9399999 ERROR 100000019399999 NONE
000000900 10000001 NONE 9399999 NONE 100000019399999 ERROR

For the JAN 000000900,

RC FLAG = 'NONE', AC FLAG = 'ERROR' and COMB FLAG = 'NONE' (for the 1st record)
RC FLAG = 'NONE', AC FLAG = 'NONE' and COMB FLAG = 'ERROR' (for the 2nd record)

So, what I would need to do is to create a single JAN 000000900 with
RC FLAG = 'NONE', AC FLAG = 'ERROR' and COMB FLAG = 'ERROR'.

I would be able to code it easily in COBOL. But, I need to code it in SAS. How could this be achieved using SAS?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 21, 2011 4:36 pm    Post subject:
Reply with quote

1) DO NOT post attachments as not everyone has the access to open them, and others like me can not be arsed to open them.

2) You have still not set out clearly the selection criteria

I suggest you expain in detail why the records being created are to be created, we know absolutely nothing of the selction criteria.

Also, please post your own code so that we can see that you are making some effort without having your PAID job done for you
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Fri Oct 21, 2011 7:19 pm    Post subject:
Reply with quote

You have "explained" nothing. Under what conditions will your single output record have AC FLAG='ERROR'? Under what conditions will your single output record have COMB FLAG='ERROR'? Are there any other values for RC FLAG besides 'NONE'? If so, what do you want the output value to be for each possible combination of input values? Can AC FLAG or COMB FLAG have values other than 'NONE' or 'ERROR'? If so, how do you want these other values handled in the output record?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Oct 21, 2011 7:22 pm    Post subject: Reply to: IMPORTANT - Require an urgent Reply.
Reply with quote

Quote:
Post subject: IMPORTANT - Require an urgent Reply.

what kind of idiotic title is that ?

from the TS profile
Quote:
Occupation: IT Professional
Mainframe Skills: COBOL,JCL,Mainframe SAS,VSAM,MCAR,MFS,PLI,COBOL - IMS-DB,DB2

since the gentleman qualifies as SAS skilled no reason for anybody to waste time replying :evil

edited to add a further comment
any reason for anybody willing to answer to go thru the 3000 lines of the attachment ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 21, 2011 7:32 pm    Post subject: Reply to: IMPORTANT - Require an urgent Reply.
Reply with quote

So,

Code:

each input record
If new key
    output saved record
    save record
    exit
end-if
for each flag
    If flag on current record = "NONE"
       replace flag on current record by flag on previous record
    end-if
end-for
save record


Remember that you have one left to do at the end of the input file (potentially, depending on later answers). Deal with the first record in the usual way. Consider what you actually want to do with single keys and with > 2 keys.

PS. I don't think the above is in SAS, but I'm sure it can deal with such logic. Possibly more succinctly than this, even.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 21, 2011 7:41 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

Now that you have been thoroughly "beat up", suggest you consider this a different kind of learning. One thing that must be developed is the ability to ask clear questions, providing enough detail so that someone can help. . .

Forums do not "do" urgent . . .

Quote:
I would be able to code it easily in COBOL. But, I need to code it in SAS.
Why must this be SAS? Just curious. . . SAS is surely not a business requirement.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Oct 21, 2011 8:32 pm    Post subject:
Reply with quote

So...

For a given key, combine to one record.

Check all occurrences of a flag, and if ANY of them are "error" within that key, then set that flag as "error" on the combined record????

If I had to what you are doing, I would use SORT. Take each record and replace "ERROR" with "00001" and replace "NONE" with "00000" (notice the five zeroes for each one).

Then, do a sort on the key field and a sum on all three of the flag fields. That way, if a given flag within a key value only has "NONE", the result record will have "00000" in that position. If it had ANY "ERROR" flags, then there will be something besides "00000" in that position.

Then, copy that file back through and change all "00000" to "NONE " and anything else, change it to "ERROR".

No program needed, no SAS needed, just a lot of trial and error getting the SORT steps set up.

Now, if you are really just a troll, trying to get the board worked up, then congrats, you got me. Otherwise, I wish you good luck in getting this working on your own. Whatever you do, DON'T post again asking someone to give you the sort steps needed to make this happen.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon Oct 24, 2011 1:19 pm    Post subject:
Reply with quote

After making own 'convenient' assumptions to all the questions by Robert,

You can try this code & modify to your needs,
Code:
<A DATASTEP TO READ THE EXTERNAL FILE>
<SORT STEP IF NECESSARY>

THEN

DATA OUTDATASET;                                       
SET INDATASET; BY JAN;                                 
RETAIN AC_FLAG2 COMB_FLAG2; DROP AC_FLAG2 COMB_FLAG2;   
  IF FIRST.JAN THEN DO;                                 
     AC_FLAG2 = 'NONE'; COMB_FLAG2 = 'NONE';           
  END;                                                 
  IF AC_FLAG = 'ERROR' THEN AC_FLAG2 = 'ERROR';         
  IF COMB_FLAG = 'ERROR' THEN COMB_FLAG2 = 'ERROR';     
  IF LAST.JAN THEN DO;                                 
     AC_FLAG = AC_FLAG2; COMB_FLAG = COMB_FLAG2; OUTPUT;
  END;                                                 
RUN;                                               


Hope it helps.
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Urgent Mainframe Requirments (2-10 yr... Shankar779 Mainframe Jobs 0 Sun Nov 27, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Developer requirement in Ku... capricorn Mainframe Jobs 0 Sun Oct 23, 2016 3:49 pm
No new posts Interface from Mainframe to Confluenc... hblun CLIST & REXX 4 Tue Sep 20, 2016 5:47 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Admin Openings with CTS enikhilk Mainframe Jobs 0 Tue Sep 13, 2016 10:13 am
No new posts Cards mainframe developer requirement... capricorn Mainframe Jobs 0 Sun Sep 11, 2016 9:57 am


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